Mysql remote access _ MySQL-mysql tutorial

Source: Internet
Author: User
Mysql remote access to bitsCN.com

The database installed on the local machine can be accessed by a local program, but the machine of the colleague cannot be connected. it is found that remote access is not enabled for the mysql database.
The solution is as follows:
----------------------------------------------------------------
My database mysql root user password = cx, enter mysql-u root to enter mysql

To allow remote access to mysql, you can use the following methods:

A. change the table.
Java code
Use mysql;
Update user set host = '%' where user = 'root ';
Select host, user from user;

B. authorization.

For example, the root user can connect to the mysql server from any host.
Java code
Grant all privileges on *. * TO 'root' @ '%' identified by 'cx 'with grant option;


If the user test is allowed to connect to the mysql server from a host with the ip address 10.40.207.17, and use cx as the password
Java code
Grant all privileges on *. * TO 'test' @ '10. 40.207.17 'identified by 'cx' with grant option;
Lush rivileges;

C: run the following command on the machine where mysql is installed:
// Enter the MySQL server
Java code
Mysql-h localhost-u root
/Grant data access permissions to any host

Grant all privileges on *. * TO 'root' @ '%' WITH GRANT OPTION
// Make the modification take effect
FLUSH PRIVILEGES
// Exit the MySQL server
EXIT

Author: "Two Sesame Seeds"

BitsCN.com

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.