Authorizing remote connection to MySQL (Linux)

Source: Internet
Author: User

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)

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.