Install the MYSQL database on the Aliyun server and connect to it remotely

 First log in to the server:

 Execute the installation command:

Download and install the official MySQL Yum Repository.

wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server

 

Execute the command to start the MySQL database

systemctl start mysqld.service

Run the following command to view the initial MySQL password.

grep "password" /var/log/mysqld.log

 Execute the command to log in to the database

mysql -uroot -p

This password is randomly generated by the cloud server and needs to be changed to your own. When the database sets the password, it will verify the strength of the password. Here you can set the security policy level according to your own needs and security registration, and I designed it as low. It is convenient for yourself to remember.

set global validate_password_policy=0;  #修改密码安全策略为低(只校验密码长度,至少8位)。
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root密码';

In the last step, everyone is used to using Navicat and other visualization tools for remote connection. You must grant remote management permissions to the root user.

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'roo密码';

 After granting the remote management permission to the root user, it is still impossible to log in remotely. After using netstat -talnp to check, it is found that port 3306 is still not opened.

Finally, you need to configure the corresponding security group policy on the cloud server to release port 3306

Finally, use the navcicat database visualization tool to connect

Guess you like

Origin blog.csdn.net/weixin_39709134/article/details/128008467