MySQL Remote access command format: MYSQL-H host address-u user name-P user Password
First modify the MySQL my.cnf file on the target server (115.159.66.51):
After modifying exit, restart the MySQL service command: sudo service mysql restart
Now try to connect MySQL with the 115.159.66.51 host
[Email protected]:/etc/mysql$ Mysql-h115.159.66.51-uroot-pxiongchao
There will be an error that cannot be connected at this time
Cause: The remote host 115.159.66.51 is not given access to MySQL server
Give host host 115.159.66.51 access to data permissions as root (note: Access to the Haibao database):
Grant all privileges the haibao.* to ' root ' @ ' 115.159.66.51 ' identified by ' Xiongchao ' with GRANT option;
Give any host access to data permissions as root (note: Access to the Haibao database):
Grant all privileges the haibao.* to ' root ' @ '% ' identified by ' Xiongchao ' with GRANT option;
Changes to take effect:
Flush privileges;
Authorizing remote connection to MySQL (Linux)