In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
            
                    
                
2025-11-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Preface
Recently, I have encountered this demand in my work, and it is estimated that it took more than an hour to get this remote connection done well. A local computer, a cloud server, are all linux systems. Let's take a look at the detailed introduction:
Steps
1. Enable remote access on the server side
First enter the mysql database, and then enter the following two commands:
?
12grant all privileges on *. * to 'root'@'%' identified by' password';flush privileges
The first * is the database, which can be changed to a database name 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
?
1service mysql restart
4. Connect remotely locally
At the terminal, enter:
?
1mysql-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.
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.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





            
            About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.