Check whether there mysql
rpm -qa | grep mysql
If there is previous version, use yum -y remove deleted.
download
Download gz package Mysql5.7 by wget command
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz
View users and groups exist
Check that Mysql combination of user presence, if not create
cat /etc/group | grep mysql
cat /etc/passwd | grep mysql
Add Mysql User Group
groupadd mysql
Create a user named mysql and join mysql user group
useradd -g mysql mysql
Set a password for mysql user
passwd mysql
installation
Copied to / usr / local / mysql directory
cd /usr/local/
/home/t/mysql-5.7.25-linux-glibc2.12-x86_64
mv mysql-5.7.25-linux-glibc2.12-x86_64 mysql
Into the / usr / local / mysql directory, using mysql_install_db bin directory install
cd /usr/local/mysql
bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
start up
/etc/init.d/mysqld restart
Solve ERROR! MySQL server PID file could not be found! Error
Mysql find relevant processes with ps, kill orders to kill
ps aux|grep mysql
kill -7 9274 9461
And then restart just fine
/etc/init.d/mysqld restart
Set boot
Enter / usr / local / mysql directory, set the boot
cd /usr/local/mysql
chkconfig --level 35 mysqld on
chkconfig --list mysqld
chmod +x /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --list mysqld
View Mysql running state
service mysqld status
SUCCESS! MySQL running (9871)
Environment Configuration
Modify / etc / profile file, add the following information to the end
export PATH=$PATH:/usr/local/mysql/bin
profile into force
source /etc/profile
reset Password
The original password to get root
change Password
Login Mysql database
mysql -uroot -p
set PASSWORD = PASSWORD('123456');
flush privileges;
Add External Access
update user host='%' where user='root'
Mysql restart
verification
Use Mysql Client Tools SQLyog, enter the version command to view Mysql View
SELECT VERSION();
或者
SELECT @@version;
stop
/etc/init.d/mysqld stop
This, Centos7 Mysql installation is over.