How to enable MySQL remote connection on a Linux Server
Method/step
• Step 1
Remotely connect to the Linux system and ensure that the MySQL database is installed on the Linux system. Log on to the database. How to enable MySQL remote connection on a Linux Server
Mysql-u $ user-p $ pwd
• Step 2
Create a user for remote connection
Grant all privileges on *. * TO '$ username' @' % 'identified by' $ password' with grant option; $ username indicates the user name, and % indicates that all computers can be connected, you can also set an IP address to run the connection. $ password indicates the password.
• Step 3
Run flush privileges. The command takes effect immediately.
Flush privileges; • Step 4
Database Query user
Select distinct concat ('user: ''', User, ''' @ ''', host, '''; ') AS query FROM mysql. user;
• Step 5
Open vim/etc/mysql/my. cnf
Bind-address = 127.0.0.1
Set to bind-address = 0.0.0.0 (device address)
Restart
/Etc/init. d/mysql restart • view the global port of MYsql (3306 by default)
# View the port number
Show global variables like 'Port ';
The configuration has been completed.