Install MySQL online on cloud server

1. Download Repo

wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

2. Install repo

yum -y install mysql57-community-release-el7-10.noarch.rpm

3. Start to install MySQL server.

yum -y install mysql-community-server

4. Start the mysql service

systemctl start mysqld.service

5. View the status of mysql

systemctl status mysqld.service

 

 

6. View the original password

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

@localhost: lxxxxl7zxn:/

7. Modify the original password

7.1 Local login

mysql -uroot -p

7.2 Change password

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';

Because the password must consist of alphanumeric special characters.

 

7.3 Set to allow simple passwords

set global validate_password_policy=0;



set global validate_password_length=1;

 

7.4 Use after modification

ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

8. Set up a remote connection.

grant all on *.* to 'username'@'%' identified by '1234';

flush privileges;

Here, username is the database account, 1234 is the database password

ps: This is also the reason why Navicat can't connect remotely

ps: The cloud server remembers the firewall to release port 3306

Switch database use mysql

 

Guess you like

Origin blog.csdn.net/qq_39655510/article/details/111501373