Enable MySQL remote access in UbuntuLinux

Source: Internet
Author: User
To provide a real running environment for the server, an UbuntuLinux server is deployed in the internal network today. The biggest headache is the installation of MySQL and the download speed of apt updates.

To provide a real running environment for the server, an Ubuntu Linux server is deployed in the internal network today. The biggest headache is the installation of MySQL and the download speed of apt.

To provide a real running environment for the server, an Ubuntu Linux server is deployed in the internal network today. The biggest headache is the installation of MySQL. apt is too slow to download updates, so I compiled the MySQL source code by myself. For details about the compilation method, refer to some information on the Internet. Here I will only give a brief description of how to start the MySQL remote access function:

(1) Check whether MySQL 3306 is open to the outside world. By default, MySQL does not provide the external access function. The method is as follows:

Java code

~ # Netstat-an | grep 3306

Tcp 0 0 127.0.0.1: 3306 0.0.0.0: * LISTEN

It can be seen from the above that port 3306 of mysql only listens to local connections, which hinders access from the external IP address to the database. The modification method is actually very simple, enter the directory of the mysql configuration file (/etc/mysql/my. cnf), find the following content in the file:

Java code

# Instead of skip-networking the default is now to listen only on

# Localhost which is more compatible and is not less secure.

Bind-address = 127.0.0.1

Comment out bind-address or change it to the IP address of the client host you want to use.

In this way, even if the mysql remote access port is enabled, another more important step is to authorize the remote user.

(2) check whether the client user has access permissions.

To grant the user access permission to the mysql client, we can authorize the user as follows:

Java code

Mysql> grant all on *. * to user_name @ '%' identified by 'user _ password ';

The user permissions granted by the preceding command can access any database and table in mysql ).

After completing the above two steps, restart mysql to remotely log on to the mysql server. The Mysql restart command is as follows:

Java code

Sudo/etc/init. d/mysql restart

The above is just a simple introduction, and it cannot be used to cure all kinds of diseases. The specific situation needs to be determined based on your own operating environment. I hope it will help you.

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.