Phenomenon
The database remote access Mysql prompts an error:Access denied for user 'root'@' .....
reason
Error reason: The server cannot be connected without authorization to this ip
solve
-
If you want root user name to use root password to connect to mysql server from any host.
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION; mysql>flush privileges;
-
If you want to allow user root to connect to mysql server from host with ip 192.168.1.3 and use root as password
mysql>GRANT ALL PRIVILEGES ON *.* TO 'user'@'192.168.1.3' IDENTIFIED BY 'password' WITH GRANT OPTION;
The above command creates a super account that can be logged in as root from any machine, and the password is root. In this way, you can use a convenient graphical tool (navicat for mysql) to log in and operate, including modifying the root password.
The username, password, and IP can be replaced with your own