1, download the tar package, can directly download the server online
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz
2. Install MySQL under/usr/local/mysql
# Unzip
TAR-XVF mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz
# Mobile
MV mysql-5.7.22-linux-glibc2.12-x86_64/usr/local/
# rename
Mv/usr/local/mysql-5.7.22-linux-glibc2.12-x86_64/usr/local/mysql
3. New Data Directory
Mkdir/usr/local/mysql/data
4. New MySQL user, MySQL user group
# MySQL User group
Groupadd MySQL
# MySQL User
Useradd mysql-g MySQL
5. Change the owner of the/usr/local/mysql and the owning group to MySQL
Chown-r Mysql.mysql/usr/local/mysql
6. Configuration
/usr/local/mysql/bin/mysql_install_db--user=mysql--basedir=/usr/local/mysql/--datadir=/usr/local/mysql/data
# Edit/ETC/MY.CNF
[mysqld]datadir=/usr/local/mysql/databasedir=/usr/local/mysqlsocket=/tmp/mysql.sockuser=mysqlport= 3306character-set-server=utf8
# Cancel Password Verification
skip-grant-tables# disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0# Skip-grant-tables[mysqld_safe]log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid
7. Open Service
# Add MySQL to the service
Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql
# power-On self-booting
Chkconfig MySQL on
# Open
Service MySQL Start
8. Set the password
# login (because the/ETC/MY.CNF is set to cancel password authentication, so here password any)
/usr/local/mysql/bin/mysql-u root-p
# operation MySQL Database
>>use MySQL;
# Change Password
>>update user Set Authentication_string=password (' Your password ') where user= ' root ';
>>flush privileges;
>>exit;
9. Delete the skip-grant-tables in/etc/my.cnf
10, login to set the password again (do not know why if you do not set the password again can not operate the database)
/usr/local/mysql/bin/mysql-u root-p
>>alter USER ' root ' @ ' localhost ' identified by ' modified password ';
>>exit;
11. Allow Remote Connection
/usr/local/mysql/bin/mysql-u root-p
>>use MySQL;
>>update user set host= '% ' where user = ' root ';
>>flush privileges;
>>exit;
12. Add Shortcut
Ln-s/usr/local/mysql/bin/mysql/usr/bin
Linux Online Perfect installation mysql2.7.22