CentOS7-yum mounted MySQL5.7

1. Download and install the MySQL official repository

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

Then install

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

Then install mysql server

yum -y install mysql-community-server

 

2. Configure mysql database

First, start the database

systemctl start mysqld.service - start 
systemctl stauts mysqld.service    - View status
 grep  " password " /var/log/mysqld.log - View the default root password

Log database

mysql -u root -p 默认密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
或
set password for 'root'@'localhost'=password('MyNewPass4!'); 
或
update mysql.user set authentication_string=password('123456') where user='root' ;

You can set a simple password to configure mysql

Global validate_password_policy = SET 0 ; 
SET Global validate_password_length = . 1 ; 
or 
in Vim / etc / increase my.cnf configuration file: 
validate_password = OFF 
default_password_lifetime = 0

Check the password rules

show variables like '%password%';

Uninstall mysql Repository, or else will be automatically updated every time yum

yum -y remove mysql57-community-release-el7-10.noarch

Guess you like

Origin www.cnblogs.com/wyid/p/11260841.html