1 System Conventions
Installation file download directory:/data/software
MySQL Directory Installation location:/usr/local/mysql
Database Save location:/data/mysql
Log Save location:/data/log/mysql
2 download MySQL
In the official website: http://dev.mysql.com/downloads/mysql/, select the following version of MySQL download:
Perform the following naming:
#mkdir/data/software
--Download the installation package
--Recommendation: Download it on windows and upload it to the/data/software directory using the tool (FileZilla);
3 Unzip the package to the target location
#cd/data/software
--Unzip the package
#tar-xzvf/data/software/mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
--Move and rename folders
#mv/data/software/mysql-5.7.21-linux-glibc2.12-x86_64/usr/local/mysql
4 Creating a Data Warehouse Catalog
--/data/mysql Data Warehouse Directory
# Mkdir/data/mysql
5 new MySQL user, group and directory
# groupadd MySQL---Create a new MSYQL group
# useradd-r-s/sbin/nologin-g mysql mysql-d/usr/local/mysql---new MSYQL user
6 Change the directory belongs to the person
#cd/usr/local/mysql
#chown-R MySQL.
#chgrp-R MySQL.
#chown-R Mysql/data/mysql
7 Configuration parameters
# bin/mysqld--initialize--user=mysql--basedir=/usr/local/mysql--datadir=/data/mysql
Note the temporary password generated here, as shown at the end of the:yli>7ecpe; Yp
#bin/mysql_ssl_rsa_setup--datadir=/data/mysql
8 Modifying the System configuration file
#cd/usr/local/mysql/support-files
# CP Mysql.server/etc/init.d/mysql
# Vi/etc/init.d/mysql
Modify the following content:
Note: mysql5.7.21 does not require MY.CNF files
Http://www.bubuko.com/infodetail-2167283.html
9 starting MySQL
#/etc/init.d/mysql Start
--Login
# mysql-hlocalhost-uroot-p
--If it appears:-bash:mysql:command not found
--On execution: # ln-s/usr/local/mysql/bin/mysql/usr/bin--no need to execute without appearing
--Enter the temporary password generated by step 6th
--Change Password
Mysql> set Password=password (' 123456 ');
--Set the host address of the root account (modified to connect remotely)
Mysql>grant all privileges on * * to ' root ' @ '% ' identified by ' root ';
Mysql>flush privileges;
--View Table
mysql> use MySQL;
Mysql> select Host,user from user;
Shown below, indicating that you can connect remotely.
--Firewall release 3306 port
Firewall-cmd--zone=public--add-port=3306/tcp--permanent
Service Firewalld Restart
--You can use the remote connection test here;
10 Adding a system path
# Vim/etc/profile
Add to:
Export Path=/usr/local/mysql/bin: $PATH
As follows:
# Source/etc/profile
11 Configuring MySQL Auto-start
# chmod 755/etc/init.d/mysql
# chkconfig--add MySQL
# chkconfig--level 345 MySQL on
Installing the mysql5.7.21 process on the CENTOS7