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

How to realize mysql remote login in centos system

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

There are two main steps to implement remote login:

(1) grant remote login rights to mysql users (table modification or authorization method)

(2) the firewall opens port 3306.

(1) granting login authority

Mysql-u root-p enter the password into the mysql.

Authorization law

Create an account test and authorize it. The password is password:

Grant all on *. * to test@'127.0.0.1' identified by "password"

Table change method

1. Switch to the mysql database:

USE mysql

two。 Modify the permissions of test:

UPDATE user SET host ='% 'WHERE user =' test'

%: any ip can be accessed

3. Check whether the user table has been modified successfully:

SELECT user,host FROM user

4. Update the database:

Flush privileges

(2) opening port 3306

1. View firewall status:

[root@study ~] # firewall-cmd-state # # results are displayed as running or not running

two。 Open the port:

# # zone-- scope # # add-port=80/tcp-- add a port in the format: Port / communication protocol # # permanent-- permanently effective. Firewall-cmd-- zone=public-- add-port=3306/tcp-- permanent expires after restart without this parameter

3. Restart the firewall

Firewall-cmd-reload

Use firewall-cmd-- help to view the help file to see more commands.

The above are the details of mysql remote login under centos, please pay attention to other related articles!

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

Database

Wechat

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

12
Report