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

What is the method of remote connection to MySQL database in Linux system

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article introduces the relevant knowledge of "what is the method of remote connection to MySQL database in Linux system". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

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'``; the first * of ``flush privileges; is a database and can be changed to the name of the database that is allowed to be accessed

The second is the table name of the database, which means that arbitrary tables are allowed to be accessed

Root represents the user name used for remote login and can be customized

% means to allow any ip login. If you want to specify a specific IP, you can replace the%.

Password represents the password used when logging in remotely, and can be customized

Flush privileges;, this is to let the permissions 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 restart4, connect remotely locally

At the terminal, enter:

Mysql-h server ip address-P 3306-u root-p and 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.

This is the end of the content of "what is the method of remote connection to MySQL database in Linux system". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Development

Wechat

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

12
Report