Use Xshell to connect to the ECS server, enter the database, and use the command
# mysql -u root -p
# Enter the mysql login password
. The commands are executed in the mysql environment.
use mysql;
SELECT user, host from mysql.user;
//View the permissions of the mysql user host used for remote access, % means that all machines are allowed to access. If the host is 127.0.0.1/localhost, then this user can only access locally, you need to change the host to%
update user set host='%' where user='root';
//若输出ERROR 1130: Host '192.168.1.3' is not allowed to connect to this MySQL ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'
//implement
flush privileges;
// check permissions again
SELECT user, host from mysql.user;
OK. You can log in remotely!