Remotely connect to a MySQL database using a client, etc.

Source: Internet
Author: User

1: Remote database (D1) Data: Database User: Root, Database password: root, database IP intranet address 192.168.100.91, database port 3306

localhost: IP 192.168.127.1

Mode one: Use the Navicat client connection.

2: First on the remote database D1 to be able to access the IP authorization, can be through the remote host Navicat "User add users, you can also use the command line to add

2.1 Use Navicat user to add access to database IP address and username password, etc.

2.2 Adding an authorized user by using the command line

For example: you want to myuser use MyPassword (password) from any host to connect to the MySQL server.

Mysql>grant all privileges on * * to 'myuser' @'%' identified by 'MyPassword' with GRANT OPTI     On; % represents all IPs.

If you want to allow users to connect to the MySQL server from a host myuser IP 192.168.1.6 and use MyPassword as the password

Mysql>grant all privileges on * * to ' myuser ' @ ' 192.168.1.3 ' identified by

' MyPassword ' with GRANT OPTION;

Mysql>FLUSH Privileges

Make the changes effective, you can.

Use:mysql> select Host,user from Mysql.user; command to see if the changes take effect.

3: The remote database enters the MySQL directory and modifies the address bindings in the MY.CNF bind-address

Cd/etc/mysql >vi my.cnf Change 127.0.0.1 (equivalent to localhost) to 0.0.0.0 (LOCALHOST+IP); the difference between the two: Https://www.cnblogs.com/bugutia N/p/5103618.html

Bind-address =0.0.0.0

This allows the remote machine to connect to the database via an IP address.

4: Restart the database, and the computer to make the configuration effective

5: Connection test via NAVICAT client:

6: Connection effect:

8: You can also connect using the command line.

C:/>mysql-h 192.168.100.91-p 3306-u Root-proot

Remotely connect to a MySQL database using a client, etc.

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.