MySQL set remote account login Summary
1. ERROR 2003 (HY00 1
2. ERROR 1045 (28000): Access denied for user ' test ' @ ' x.x.x.x ' (using Password:no) 1
3. Retrieve the root password and set up Telnet 2
4. Rror 1062 (23000): Duplicate entry '%-root ' for key ' PRIMARY ' 2
5. ERROR 1044 (42000): Access denied for user "@ ' localhost ' to database ' MySQL '. 3
6. Set user remote host connection Permissions 4
7. Set permissions for users and libraries 4
----author Attilax, [email protected]
In order to set a remote connection permission to the MySQL user, experienced a lot of twists and turns. It is hereby recorded. First the Jade to 2003 wrong
ERROR 2003 (HY00
The reason is that MySQL takes security into account, and the default configuration only lets you log on locally
Open/etc/mysql/my.cnf file, find bind-address = 127.0.0.1 modified to bind-address = 0.0.0.0
Restart Mysql:sudo/etc/init.d/mysql restart
Connect again, error 1045 occurred
ERROR 1045 (28000): Access denied for user ' test ' @ ' x.x.x.x ' (using Password:no)
A: The reason is that the logon user name is not set to the remote host logon permission. There is also the possibility that you need to reset the password .... This sequela may be caused by an authorized operation.
Log in locally with root: Mysql-u root-p
Modify the Host field in the user table in the MySQL database to apply the user name, and change localhost to%
Use MySQL;
Update user Set Host = '% ' where user = ' username ';
To set this permission requires the root user to log in. Unfortunately, the root password does not remember.
Retrieve root password and set remote login
Mysqld_safe--skip-grant-tables &
Mysql-u Root MySQL
mysql> UPDATE user SET Password=password (' NewPassword ') where user= ' root ';
mysql> FLUSH privileges;
Set root remote connection update user set host = '% ' where user= ' ROOT ';
View the process, you can see the mysqld_safe and MySQL process, at this time, MySQL is working normally, but view the parameters, you can see--skip-grant-tab
Enter the Mysqld_safe command line to enter Mysql-u root MySQL immediately, no error. Or you can open a new window.
1062 error occurred while performing update
Rror 1062 (23000): Duplicate entry '%-root ' for key ' PRIMARY '
If error 1062 (23000) occurs when an UPDATE statement is executed: Duplicate entry '%-root ' for key ' PRIMARY ' errors, it indicates that there are multiple root users logged in the user table.
Need select host from user where user = ' root ';
Check to see if the host has a% of this value, you can have it.
Mysql> Select Host,user from user where user= ' root ';
+-----------------------+------+
| Host | user |
+-----------------------+------+
| % | Root |
| 127.0.0.1 | Root |
| :: 1 | Root |
| Localhost.localdomain | Root |
Then use the root user login to change the remote connection permissions for the user account. Prompt: Error 1044 (42000): Access denied for user ' @ ' localhost ' to database ' MySQL '.
ERROR 1044 (42000): Access denied for user "@ ' localhost ' to database ' MySQL '.
is because the user table of the MySQL database, there is a username is empty account is anonymous account, resulting in the login is the use of root, but the actual anonymous login, through the error message "@" localhost can be seen, so the solution see
Close the MySQL process first:
And then
# Mysqld_safe--skip-grant-table
Screen appears: Starting demo from .....
At this point, remember, immediately after the input
# mysql-u Root MySQL
mysql> Delete from user where user= ';
mysql> FLUSH privileges;
If the starting demo from is present. After.. Enter other commands first, and then use Mysql-u root MySQL. It's going to make this mistake again.
Then kill the MySQL process,.. Restart the normal process.
Set user remote host connection permissions
Update user Set host = '% ' where user= ' fanzkcom_fanzk ';
FLUSH privileges;
But in the actual connection, although can connect, but go without the permission of the library, Halo.
Have to set permissions next
Set permissions for users and libraries
Grant all privileges the fanzkcom_fanzk.* to [email protected] '% ' identified by ' 1234 ';
FLUSH privileges;
Single quotation marks on both sides of the percent semicolon, otherwise syntax error
Then the connection, unexpectedly prompted 1045 error. Halo, think for a long time, or reset the password under test.
Update Mysql.user set Password=password (' XXX ') where user= "Fanzkcom_fanzk"
Flush privileges;
It's all right. Dizzy. I don't know why the setup authorization will change the password. Strange. It's supposed to be a MySQL bug.
Reprint: http://blog.csdn.net/attilax/article/details/8595696#_Toc25697
Paip. MySQL set remote account login Summary