Install one of the MySQL methods, compared to the source package and RPM installation convenient many
can go directly to the official download binary package
Need to uninstall MARIADB first
RPM-E Mariadb-libs--nodeps
Unzip directly, move
Tar zxf mysql-5.7.20-linux-glibc2.12-x86_64.tar.gzmv mysql-5.7.20-linux-glibc2.12-x86_64/usr/local/mysql
Create users and Groups
Groupadd Mysqluseradd-r-G mysql-s/bin/false MySQL
Edit Master profile (start only, other configurations can be added by yourself)
echo [mysqld] >/etc/my.cnfecho socket=/tmp/mysql.sock >>/etc/my.cnfecho basedir=/usr/local/mysql >>/ Etc/my.cnfecho Datadir=/usr/local/mysql/data >>/etc/my.cnf
Create a data directory and grant permissions
Mkdir/usr/local/mysql/datacd/usr/local/mysql/chmod datachown-r MySQL. chgrp-r MySQL.
Adding environment variables
echo "Export path= $PATH:/usr/local/mysql/bin" >>/etc/profilesource/etc/profile
Initialization
Bin/mysqld--initialize--user=mysql
Boot, and start
CP/USR/LOCAL/MYSQL/SUPPORT-FILES/MYSQL.SERVER/ETC/INIT.D/MYSQLDSYSTEMCTL Daemon-reloadsystemctl Enabled Mysqlsystemctl start MySQL
Set MySQL password
Cd/usr/local/mysql/bin/mysqladmin-u Root-password 123456
After setting the password, you can log in normally, and we recommend this method
MySQL installation binary