Linux: Centos7 installation Mysql5.7

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

Linux: Centos7 installation Mysql5.7

 

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/
Linux: Centos7 installation Mysql5.7

 

start up

/etc/init.d/mysqld restart
Linux: Centos7 installation Mysql5.7

 

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
Linux: Centos7 installation Mysql5.7

 

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

Linux: Centos7 installation Mysql5.7

 

change Password

Login Mysql database

mysql -uroot -p
Linux: Centos7 installation Mysql5.7

 

set PASSWORD = PASSWORD('123456');

flush privileges;

Linux: Centos7 installation Mysql5.7

 

Add External Access

update user host='%' where user='root'
Linux: Centos7 installation Mysql5.7

 

Mysql restart

Linux: Centos7 installation Mysql5.7

 

verification

Use Mysql Client Tools SQLyog, enter the version command to view Mysql View

SELECT VERSION();
或者
SELECT @@version;
Linux: Centos7 installation Mysql5.7

 

stop

/etc/init.d/mysqld stop
Linux: Centos7 installation Mysql5.7

 

This, Centos7 Mysql installation is over.

Guess you like

Origin www.cnblogs.com/WIU1905/p/11802867.html
Recommended