N5ken's technical blog

Just another WordPress.com site

Remote accessing to MySQL

For the original post, please visit:

http://blog.csdn.net/n5ken/archive/2008/08/25/2825378.aspx

1. Firstly, login to MySQL by command line in your local machine, e.g.

root@ubuntu:~# mysql -u root -p

2. Executing the following command to grant the privileges

mysql> grant all on *.* to root@'%' identified by "root";

Here ‘all’ can be replaced by ‘select’, ‘update’, ‘insert’, ‘delete’ and so on.
*.* represent all databases and all tables
root@’%’ means all user root to access from every ip address, ‘%’ may replace by a specific ip address
identified by “root” means give user root a password “root” for login

3. After the step 2 done, you need to run “flush privileges;” to update your settings

To show the privileges you just configured, you can run

show grants for [your user name]

for example:

show grants for root@'localhost';
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: