Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of remote connection to MySQL Database under Linux

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Trampling notes

It probably took more than an hour to get this remote connection right. A local computer, a cloud server, are all linux systems.

Steps

1. Enable remote access on the server side

First enter the mysql database, and then enter the following two commands:

Grant all privileges on *. * to 'root'@'%' identified by' password';flush privileges The first * is the database, which can be changed to the database name that allows access. The second is the table name of the database, which represents the user name that allows access to any table root, represents the user name used for remote login, and customizes% represents the user name used for remote login. If you want to specify a specific IP, you can replace% for the password used for remote login. You can customize flush privileges; to allow permissions to take effect immediately.

2. Modify my.cnf configuration file

This is the configuration file for mysql. If you can't find the title article, you can type find / *-name my.cnf to find it.

Edit the file through vim, find the sentence bind-address = 127.0.0.1, then add a # comment in front of it, and save and exit

3. Restart the service

Service mysql restart

4. Connect remotely locally

At the terminal, enter:

Mysql-h server ip address-P 3306-u root-p

Then enter the password.

Root is the user name set at point 1, and the password is also the password set at point 1.

Some details.

Found a lot of articles on the Internet, said to open port 3306 to connect, but I opened but still could not connect, and then found some articles, said to change the my.cnf, that is, the second point above, change and then restart the server on it.

Just tried on another server, no port has been configured, through the above three steps, quickly connected.

So the second point is very important, basically everyone will configure that file when installing mysql, because the character set needs to be configured. So there must be that file, just use the find command to find it.

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report