当前位置:网站首页>Install MySQL in ECS (version 2022)

Install MySQL in ECS (version 2022)

2022-06-22 21:08:00 Call me uncle

Catalog

One 、 Installation steps

1、 Check if it has been installed before

2、 Download the official Mysql package

3、 install MySQL package

 4、yum install MySQL

 5、 start-up MySQL service

6、 see MySQL Running state

7、 Check the initial password ( The red part is the initial password )

8、 Access to database

9、 Set password free login

 10、 Restart the service

Two 、 Error reporting and solutions


One 、 Installation steps

1、 Check if it has been installed before

rpm -qa| grep mysql

Normal is not , If it has been installed, you can delete it with the following command

rpm -e  file name 

2、 Download the official Mysql package

  • Enter into usr/local

  •   Download the official Mysql package
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

3、 install MySQL package

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

 4、yum install MySQL

yum -y install mysql-community-server --nogpgcheck

 5、 start-up MySQL service

 systemctl start mysqld.service

6、 see MySQL Running state

service mysqld status

7、 Check the initial password ( The red part is the initial password )

grep 'password' /var/log/mysqld.log

8、 Access to database

mysql -u root -p

9、 Set password free login

exit; sign out mysql>

close mysql service

service mysqld stop

adopt vi Enter file

 vi /etc/my.cnf

 10、 Restart the service

 start mysqld.service
 mysql -u root -p

  adopt show databases;   Remember to bring a semicolon

  Enter the configuration file my.cnf in , Delete skip-grant-tables restart , Landing at

Two 、 Error reporting and solutions

problem :

When connecting to the database, the following error will be reported if the connection fails

terms of settlement : 

  • The following error will be reported when entering the database

terms of settlement :

mysql> set global validate_password_policy=0;
mysql> set global validate_password_length=1;
mysql> SET PASSWORD = PASSWORD('123456789');
mysql> ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
mysql> flush privileges;

  The reason is that the password is too simple , Just do it

  •   modify usr Below host
mysql> use mysql;
mysql> show tables;
mysql> select user from user;
mysql> select host,user,authentication_string from user;
mysql> update user set host='%' where user='root';
----- restart ----------
 service mysqld restart

 

 

原网站

版权声明
本文为[Call me uncle]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206221938584943.html