Reference article: https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/
For some reason, MySQL is removed from the default Yum source of CentOS7 and replaced by MARIADB.
Yum List mysqlerror:no matching Packages to Listyum list mariadbavailable packagesmariadb.x86_64 *:*. *. *
When you want to install MySQL through yum, you have to do some preparation.
First to
https://dev.mysql.com/downloads/repo/yum/
This site to download the corresponding RPM source
Download the corresponding version of Linux 7
Wget-c https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
Import the downloaded file to the source
RPM-UVH mysql57-community-release-el7-11.noarch.rpm
This is the time to install MySQL in yum.
Yum-y Install Mysql-community-server
Start and initialize MySQL
Systemctl Start mysqld
This is the time to log in to MySQL with the root user.
What the? You said you didn't know the password. All right, look in the MySQL log.
grep ' temporary password '/var/log/mysqld.log
Well, finally into MySQL, and then we do something, hint
ERROR 1820 (HY000): Must reset your password using ALTER USER statement before executing this statement.
Let's change the default password
ALTER USER ' root ' @ ' localhost ' identified by ' 123456 '; ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
Say my password is not safe! My own local database for testing you asked me to set up a complex code, and I'm sick of it.
Find/ETC/MY.CNF
Here is a brief description of the MySQL configuration file
[mysqld]# Server default character set character-set-server=utf8# table name default is lowercase lower_case_table_names=1# listening port default 3306port=3306# SQL execution mode sql_ mode=no_engine_substitution,strict_trans_tables# Check Password Validate-password=off
Configure shutdown password Check after restarting MySQL service
Systemctl Restart Mysqld
Then log in to MySQL and change the default password to use the simple password.
If you want to log in remotely using the root user, you also need to change the root user's host
Use Mysql;update user set host= '% ' where user= ' root '; flush privileges;
This time the construction is complete.
This article is from the "MMX Saros double Tree Garden" blog, please be sure to keep this source http://ohmmx.blog.51cto.com/12884864/1924912
CentOS7 using the source to install MySQL