CentOS7 Installation configuration Mysql5.6
One 、 download mysql Compressed package
- Download address Check if there are any installed mysql
rpm -qa | grep mysql If any , Uninstall the lower version of MySQLrpm -e --nodeps mysql*
3、 ... and 、 see Mariadb Version and delete
View currently installed mariadb package :rpm -qa | grep mariadb All uninstalled :rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64( This version is based on CentOS7 It depends on the version in )
Four 、 Delete /etc Under the my.cnf
The specific command is as follows :
# cd /etc# rm my.cnf
5、 ... and 、 install mysql
1、 Create in the root directory data/ Catalog
mkdir data
2、 Put the zip into that directory and unzip
tar -xvf mysql-5.6.43-linux-glibc2.12-x86_64.tar.gz
3、 Modify the folder name after decompression
mv mysql-5.6.43-linux-glibc2.12-x86_64 mysql-5.6.43
4、 establish MySQL Users and user groups
- Execute the following command to create mysql User group
[[email protected]~]# groupadd mysql
- Execute the following command to create a user name of mysql And join mysql User group
[[email protected] ~]# useradd -g mysql mysql
5、 Copy profile
cp /data/mysql-5.6.43/support-files/my-default.cnf /etc/my.cnf
- Modify the configuration file
vi /etc/my.cnf
Bear in mind : In the configuration file socket=/tmp/mysql.sock, Otherwise, the database cannot be started
- Initialize database
6、 Modify the permissions
cd /data/mysql-5.6.43chown -R mysql.mysql /data/mysql-5.6.43
7、 mount this database
[[email protected] mysql-5.6.43] # ./scripts/mysql_install_db --user=mysql
- Modify the current data Directory owner is mysql user
[[email protected] mysql-5.6.43] # chown -R mysql.mysql /data/mysql-5.6.43
6、 ... and 、 To configure MySQL
1、 grant my.cnf The maximum authority of .
[[email protected] mysql-5.6.43]# chown 777 /etc/my.cnf
2、 Set the startup service control script :
3、 Copy the startup script to the resource directory
[[email protected] mysql-5.6.43]# cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
4、 increase mysqld Service control script execution authority
[[email protected] mysql]# c.........