Get the App
SLTechnology News&Howtos  ›  Database  › 

How to realize mysql remote login in centos system

Shulou Source: shulou.com Published: 2022-06-01 18:54:41 09月20日 Update

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!

Tags: Port login permissions firewall fire protection password data database more open successful two functions content parameters commands that is files articles formats Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Docker MySQL Microsoft Xiaomi