Linux Open MySQL remote connection

Source: Internet
Author: User

Turn on MySQL remote settings
1. Log in to MySQL

2. Create a user to connect remotely
mysql> use MySQL;
Mysql> GRANT All privileges on * * to ' root ' @ '% ' identified by ' 123456 ' with GRANT OPTION;
mysql> flush Privileges;
#root表示用户名;% indicates that all computers can be connected or set an IP address to run; 123456 is the root password

3. View the connection
Mysql>select host,user from user;
+-----------+------+
| Host | user |
+-----------+------+
| %         |     Root | #主要要有这个
| 127.0.0.1 | Root |
|      Linux | |
| Linux | Root |
|      localhost | |
+-----------+------+
5 rows in Set (0.00 sec)

or SELECT DISTINCT CONCAT (' User: ', user, ' @ ', host, '; ') as query from Mysql.user;


4. Then open nano/etc/mysql/my.cnf
Set bind-address = 127.0.0.1 to bind-address = 0.0.0.0 # (device address)

5. Restart MySQL service MySQL restart

6, if there is a firewall, service iptables stop//temporarily shut down, can also be modified through the configuration file open 3306

Linux Open MySQL remote connection

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.