1. Log in to MySQL as an administrator
Mysql-u root-p
2. Select MySQL Database
Use MySQL
3. Create a user and set a password
Create user ' test ' @ ' localhost ' identified by ' 123456 '
4. Make the Operation effective
Flush Privileges
5. Make the Operation effective
Flush Privileges
6. Log in with a new user
Mysql-u test-p
Ways to allow users to access the database remotely
Workaround (It is recommended to use the second method for resolution):
1. Change the table method. It may be that your account is not allowed to log on remotely, only on localhost. This time, as long as the computer on the localhost, log in to MySQL, change the "MySQL" Database in the "User" table "host", from "localhost" to "%"
Mysql-u root-p
Mysql>use MySQL;
Mysql>update User Set host = '% ' where user = ' root ';
Mysql>select host, user from user;
2. Authorization law. For example, if you want to myuser use MyPassword to connect to a MySQL server from any host.
GRANT all privileges on * * to ' myuser ' @ ' percent ' identified by ' MyPassword ' with GRANT OPTION;
If you want to allow users to connect to the MySQL server from a host myuser IP 192.168.1.3 and use MyPassword as the password
GRANT all privileges on * * to ' root ' @ ' 192.168.1.3 ' identified by ' MyPassword ' with GRANT OPTION; (Only fixed IP login allowed)
PS: After you can use the new account remote link MySQL, a part of the small partners may also report a 2003 of the error, obediently quickly look at your server is not the firewall is not shut, not shut the words quickly gay off him
╭~~~╮
(O~.~o)
.
.
.
.
Hey, if you turn off the firewall or not, then it's the ultimate big trick.
Modify the default profile my.cnf in the bind-address, generally in the/etc directory, put this sentence before adding a # can be, OK perfect solution
Reprinted from http://blog.csdn.net/chr23899/article/details/40401089
Add a remote connection account to MySQL