Installation Environment: CentOS7 64-bit mini version, install MySQL5.7
1. Configure the Yum source
Download the Yum source RPM installation package on the MySQL website: http://dev.mysql.com/downloads/repo/yum/
# 下载mysql源安装包shell> wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm# 安装mysql源shell> yum localinstall mysql57-community-release-el7-8.noarch.rpm
Check that the MySQL source is installed successfully
| grep "mysql.*-community.*"
See shown indicates successful installation.
You can modify vim /etc/yum.repos.d/mysql-community.repo
the source to change the MySQL version of the default installation. For example, to install version 5.6, the 5.7 source of the enabled=1 changed to Enabled=0. Then change the 5.6 source enabled=0 to Enabled=1. The effect after the change is as follows:
2. Install MySQL
shell> yum install mysql-community-server
3. Start the MySQL service
shell> systemctl start mysqld
To view the startup status of MySQL
shell> systemctl Status Mysqld mysqld. Service-mysql Server loaded:loaded (/usr/lib/systemd/system/mysqld. Service; Disabled Vendor preset:disabled) active:active (running) since five2016-06-2404:37:Panax Notoginseng CST; 35min ago Main PID: 2888 (mysqld) CGroup:/system. slice/mysqld. service└─ 2888/usr/sbin/mysqld--da Emonize--pid-file=/var/run/mysqld/mysqld. PIDJune : Notoginseng:$localhost. localdomain systemd[1]: Starting MySQL Server ... June: Panax notoginseng: localdomain systemd[1]: Started MySQL Server.
4. Boot start
shell> systemctl enable mysqldshell> systemctl daemon-reload
5. Modify the root local login password
After the MySQL installation is complete, a default password is generated for root in the/var/log/mysqld.log file. Locate the root default password in the following way, and then log in to MySQL to modify it:
shell> grep ‘temporary password‘ /var/log/mysqld.log
shell> mysql -uroot -p //登录mysql
CentOS 7 Installation MySQL