1. Download MySQL
In the official website: http://dev.mysql.com/downloads/mysql/, select the binary MySQL version to download:
#wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
2. Unzip
#tar-XZVF mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz--Unzip
#mv Mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz/usr/local/mysql--renaming and moving to/usr/local
Note: It is recommended to place this path in/usr/local/mysql
# Cd/usr/local/mysql
# mkdir Data--Creating the Data directory
3. Change the directory owner
#chown-R root:root. --Change the root user of the directory owner root Group
4. Create a 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 Forbidden Login Shell
5. Configuration Parameters
# bin/mysqld--initialize--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data
Note: It is important to note that the temporary password generated by the record is in localhost: back
# Bin/mysql_ssl_rsa_setup--datadir=/usr/local/mysql/data--Generate SSL
6 Modifying the System configuration file
#cd/usr/local/mysql/support-files
#vi my_default.cnf--Create file VI my_default.cnf file
Under this directory, create the file my_default.cnf, and modify the following configuration:
[Mysqld] user = MySQL Port = 3306 server_id = 1 Socket=/tmp/mysql.sock Basedir =/usr/local/mysql DataDir =/usr/local/mysql/data Character-set-server=utf8 [Client] Socket=/tmp/mysql.sock |
Save File
#cp my-default.cnf/etc/my.cnf--Copy my.cnf file
#cp mysql.server/etc/init.d/mysqld--Copy mysqld file
#chmod 755/etc/init.d/mysqld--Modify mysqld file permissions
#vi/etc/init.d/mysql--Edit the Mysqld file to modify the following:
Basedir=/usr/local/mysql DataDir =/usr/local/mysql/data |
7. start MySQL
#service mysqld Start--turn on MySQL
#mysql-uroot–p--Log in to MySQL
Note: 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
8. Change the password
Mysql> set Password=password (' root '); --Change Password to root
Mysql>grant all privileges on * * to ' root ' @ '% ' identified by ' root '; --Set the host address of the root account (modified to connect remotely)
Mysql>flush privileges;
CENTOS7/64 installation MySQL 5.7.192 Package Tutorial