Authorize remote connection to MySQL (Linux) and authorize mysqllinux
Command Format for MySQL Remote Access: mysql-h host address-u username-p User Password
First, modify the my. cnf file of mysql on the target server (115.159.66.51:
After modification and exit, restart mysql service command: sudo service mysql restart
In this case, try to use the 115.159.66.51 host to connect to mysql
Ubuntu @ VM-194-212-ubuntu:/etc/mysql $ mysql-h115.159.66.51-uroot-pxiongchao
The connection fails.
Cause: the remote host 115.159.66.51 is not authorized to access the mysql server.
Grant the host 115.159.66.51 the data access permission as the root (Note: access the haibao database ):
Grant all privileges on haibao. * to 'root' @ '1970. 159.66.51 'identified by 'xiongchun' with grant option;
Grant data access permissions to any host as root (Note: Access haibao database ):
Grant all privileges on haibao. * to 'root' @ '%' identified by 'xiongchun' with grant option;
The modification takes effect:
Flush privileges;
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.