Authorize remote connection to MySQL (Linux) and authorize mysqllinux

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.