Remote access to the MySQL database on the server, the discovery root remote connection is not on, prompt error: "1045-access denied for user [email protected]"
The workaround is as follows, execute the command:
mysql> use MySQL;
Mysql> selecthost,user from user;
See if the root user is allowed to log on locally (localhost) only, this is the case.
Yes, it is necessary to modify its host to%, which means that any IP address can be logged in.
GRANT all privileges on * * to ' root ' @ '% ' identified by ' root ' with GRANT OPTION;
mysql> flush Privileges;
Flush the cache. After you modify a user record by using the UPDATE statement, the FLUSH statement is required to tell the server to overload the authorization table.
Not successful yet?
1. Start the mysql cmd command
2. Using the "Use MySQL" command, select the database you want to use, modify the basic information of the remote connection, save it in the MySQL database, and use the MySQL database.
3. Use "Grant all privileges on *. * to ' root ' @ '% ' identified by ' root ' with Grant OPTION;" command to change the settings for a remote connection.
4. Use "Flush privileges;" command to refresh the permission that you just modified to take effect.
5. Use "select Host,user from User;" See if the changes were successful.
6. You will not be able to access it after that. Then went to the server local access to see a bit.
Above, the last line of% root password changed to be the same as the first one.
You can then access it.
The other connection is not a problem:
Firewall Port adding ports to listen on
/sbin/iptables-i input-p TCP--dport 3306-j ACCEPT
Save Settings
/etc/init.d/iptables Save
View status
/etc/init.d/iptables status
Temporarily shutting down the firewall server
Iptables stop
Turn on Firewall service
Service Iptables Start
Boot no longer starts Firewall service
Chkconfig iptables off
MySQL database on remote access server, root remote connection not found