Install Myql in yum mode
Environment
OS:CentOS7.6
Mysql:Mysql5.7
Get update package
Mysql official website: https://dev.mysql.com/
Go to http://dev.mysql.com/downloads/repo/yum/ to download the rpm package and update it. # download mysql source installation package wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm# install MySQL source yum localinstall mysql57-community-release-el7-8.noarch.rpm# check whether the source is successfully installed yum repolist enabled | grep "mysql.*-community.*"
Installation
Modify the configuration yum install mysql version, install the MySQL5.7 version here, modify "enabled=1".
Vim / etc/yum.repos.d/mysql-community.repo#Enable to use MySQL 5.6 [mysql56-community] name=MySQL 5.6 Community Serverbaseurl= http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/enabled=0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql[mysql57-community]name=MySQL 5.7 Community Serverbaseurl= http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/enabled=1gpgcheck=1gpgkey=file:/// Etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Yum installation
Yum install mysql-community-server
Systemctl start mysqld / / start the mysql service
Systemctl status mysqld
Systemctl enable mysqld
Systemctl daemon-reload / / reload service
Configuration
A default password is generated when mysql5.7 is installed, and the file that looks at this password usually exists on / var/log/mysqld.log.
Grep 'temporary password' / var/log/mysqld.log
Log in to mysql
Mysql-uroot-p
You can see that the mysql5.7 version is required to change the password after logging in by default. The password mechanism is adopted. The default is medium, and the password is required to have uppercase letters and special characters.
Change the password: mysql > set password for 'root'@'localhost'=password (' xxxxxxxx')
View password policy:
Mysql > show variables like'% password%'
0 = > LOW,1 = > MEDIUM,2 = > STRONG
Command line modification:
Set global validate_password_policy=0; / / set password policy level
Set global validate_password_length=6; / / set the minimum password length
Restart the mysql service
Systemctl restart mysqld