When the recently installed Mysql on Linux, then connect via Navicat In the Windows environment, the emergence of error: 1045 Access denied for user 'root' @ 'XXX' (using password: YES), as follows:
First of all, you can log in Linux is mysql normal, so it will not be a user password error.
Then, I take into account possible relation to the Firewall, then check whether a firewall in Linux open the corresponding port, found that the firewall is turned off at this time, it is possible to eliminate the influence of the firewall.
Finally, I suddenly thought of by default mysql root user is not a remote connection, then log in mysql in Linux and found that it really was for this reason that the settlement process is as follows:
- 1. Log mysql, the command: MySQL -u root -p , and then enter the password.
2. Check the mysql database user table of the host field
Use mysql database: use mysql
query information: the SELECT the User, the User from Host
host field, represents localhost only allow access to the machine, to be remotely connected, the root can be changed to the user's host%,% means allows any host to access, if necessary set to allow only certain access ip, ip should be replaced by the corresponding .
3. Modify the root host field, the command: Update User SET host = "%" WHERE User = "root"
4. Make The changes take effect immediately, the command: flush privileges
Finally, remote connection in Navicat under the windows, would not the error.