Home > Database > Mysql Tutorial > body text

How to open MySQL port 3306?

黄舟
Release: 2019-02-27 15:04:43
Original
27322 people have browsed it

MySQL is a relational database management system. When we use a database, we don't just use the database on this machine. So remote access to this is required.

I didn’t know the reason at first. The database just couldn’t be connected. Later I found out that it was because the database did not open port 3306. Let me share my experience below to prevent more people from wasting time in this place. (The following is for installing mysql under Linux)

Recommended related mysql video tutorials: "mysql tutorial"

Method 1

1. First, enter the console. The picture below shows the remote control I used putty tool.

Then enter "netstat -an | grep 3306" to check whether it is enabled. As shown in the figure below, only listen indicates that it is not enabled.

How to open MySQL port 3306?

2. After that, enter the etc/mysql directory through the cd command. Then enter the ls command to see the files in the directory.

3. You will see my.cnf in the file. Enter the editing state through the "vi my.cnf" command.

4. After that, comment out "bind-address =127.0.0.1" or replace it with the IP address that requires remote connection, or delete this sentence directly.

Then, just save.

Method 2

1. After that, change the permissions of the folder through the command, enter sudo chomd 666 + file name, backtest, you can increase the permissions of the file (If it is a folder, you need to add -ld at the end)

2. After that, search through the folder to etc/mysql. As shown below. (Enter the directory by first selecting file system, selecting etc, and then selecting mysql)

3. Finally, select the my.cnf file, click to open, and then bind-address = 127.0.0.1" comment out or replace it with the IP address that requires remote connection, or delete this sentence directly.

Click to close and save.

The above is the detailed content of How to open MySQL port 3306?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template