1. Download the mysql source installation package
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
2. Install the mysql source
yum localinstall mysql57-community-release-el7-8.noarch.rpm
3. Check whether the mysql source is installed successfully
yum repolist enabled | grep "mysql.*-community.*"
4. When you see the picture above, the installation is successful.
You can modify the vim /etc/yum.repos.d/mysql-community.repo source and change the default installation. mysql version. For example, to install version 5.6, change the enabled=1 of the 5.7 source to enabled=0. Then change the enabled=0 of the 5.6 source to enabled=1. The effect after the modification is as follows:
5. Install Mysql
yum install mysql-community-server
6. Start Mysql
systemctl start mysqld
7. Start up
systemctl enable mysqldsystemctl daemon-reload
8 .Modify the root local login password
After the mysql installation is completed, a default password is generated for root in the /var/log/mysqld.log file. Find the root default password in the following way, and then log in to mysql to modify it:
grep 'temporary password' /var/log/mysqld.log
Command:
mysql -uroot -p
Question: centos7.0 is installed After mysql5.7.11, use mysql -u root -p to connect to the database. Operation tip: You must reset your password using ALTER USER statement before executing this statement.
Following the prompts ALTER USER to change the password is invalid. Later I found that executing the following command can be done:
SET PASSWORD = PASSWORD(‘123456’); set password for 'root'@'localhost'=password('你的新密码');
The default password check policy requires that passwords must contain: uppercase and lowercase letters, numbers, and special symbols, and must be no less than 8 characters in length. Otherwise, the error ERROR 1819 (HY000): Your password does not satisfy the current policy requirements will be prompted, as shown in the following figure:
##
grant all on *.* to 'root'@'127.0.0.1' identified by '123123'WITH GRANT OPTION; flush privileges; //刷新权限表
systemctl restart mysqld
The above is the detailed content of Linux source code installation mysql5.7. For more information, please follow other related articles on the PHP Chinese website!