Wednesday, November 12, 2008

Granting Access to database from remote IP


View more similar posts...visit my personal site http://santhoshg.co.cc Also visit my forum http://santhoshg.co.cc/forum

* Login as root to mysql server .

Your shell prompt should now look like this:
mysql>

* Run the command:

GRANT ALL PRIVILEGES ON DATABASENAME.* TO USERNAME@IP IDENTIFIED BY 'PASSWORD';


USERNAME is the username that you would like to create. IP is the public IP address of your remote connection. PASSWORD is the password you would like to use for this username.


For example:

To grant access to database 'testdb' for the user 'alpha' identified by password 'changeme' from remoteip 62.54.10.20

GRANT ALL ON testdb.* TO alpha@'62.54.10.20' IDENTIFIED BY 'changeme';

* You now must flush MySQL's privileges

FLUSH PRIVILEGES;

* Run this command to exit MySQL

exit;

To allow remote Access to particular table in the database

GRANT ALL PRIVILEGES ON DATABASENAME.TABLENAME TO USERNAME@IP IDENTIFIED BY 'PASSWORD';

For example: To grant access to a table t1 in database alpha for the user testdb identified by password changeme from remoteip 62.54.10.20

GRANT ALL ON testdb.t1 TO alpha@'62.54.10.20' IDENTIFIED BY 'changeme';


GRANT ALL PRIVILEGES ON valija_registro.* TO valija_gi2@63.246.5.127 IDENTIFIED BY 'gitanava';

http://santhoshg.co.cc/forum/viewtopic.php?f=7&t=496&sid=6adebb0fcd24f7292047cb091f31cf94

No comments: