Solve the Problem of remote connection to MySQL on Linux Server

Source: Internet
Author: User
After installing MySQL on the server in the lab today, you can find that a remote computer cannot connect to the MySql server. The operating system of the server is Ubuntu14.04. So I checked some information on the Internet and finally got it done after a long time. The specific steps are as follows. After installing MySQL, modify the following file sudovimetcmysqlmy. cnf and find bind-.

After installing MySQL on the server in the lab today, you can find that a remote computer cannot connect to the MySql server. The operating system of the server is Ubuntu 14.04. So I checked some information on the Internet and finally got it done after a long time. The specific steps are as follows. After installing MySQL, modify the following file sudo vim/etc/mysql/my. cnf and find bind-.

After installing MySQL on the server in the lab today, you can find that a remote computer cannot connect to the MySql server. The operating system of the server is Ubuntu 14.04. So I checked some information on the Internet and finally got it done after a long time. The specific steps are as follows.

After installing MySQL, modify the following file:

sudo vim /etc/mysql/my.cnf

Findbind-address = 127.0.0.1, Change the binding address0.0.0.0Or comment out the row directly.

Then start the MySQL Service

sudo /etc/init.d/mysql start

Open MySQL

sudo mysql -uroot -p

Enter the password, enter the MySQL command line, and execute the following commands in the MySQL Command Line

grant all PRIVILEGES on *.* to root@'%' identified by 'onePassword';

Run

use information_schemaselect * from user_privileges;

If the query has the following results:'root'@'%', Indicating that mysql has authorized remote connection.
Exit MySQL command line and execute

iptables -A INPUT -p tcp --dport 3306 -j ACCEPT

Add port 3306 to iptables.
Run the following command to restart the MySQL service.

sudo /etc/init.d/mysql restart

Then other computers can remotely connect to the MySLQ on the server. Although the problem is not big, it is not the first time, but every time it takes a lot of time to solve the problem, make a small record, in case you encounter similar problems in the future, you have to start from scratch.

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.