This article references from the blog park, thanks to the original author.
1 , preparing the file system for data storage
Create a new logical volume and mount it to a specific directory. The process is no longer given here.
This assumes that the mount directory of its logical volume is /data, and then needs to create the/data/mysqldata directory as MySQL The directory where the data is stored.
[Email protected]/]# mkdir-p/data/mysqldata
2 , the new user runs the process in a secure manner:
[[email protected] ~]# groupadd-r MySQL [[email protected] ~]# useradd-g mysql-r-s/sbin/nologin-m-d/data/mysqldata Mysql
[Email protected] ~]# chown-r mysql:mysql/data/mysqldata
3 , install, and initialize mysql-5.6.23
Download First linux64 bits binary version of the MySQL5.6 to local, mysql-advanced-5.6.23-linux-glibc2.5-x86_64.tar.gz
[email protected] ~]# tar xf mysql-advanced-5.6.23-linux-glibc2.5-x86_64.tar.gz-c/usr/local # The installation package name needs to be modified
[Email protected] ~]# cd/usr/local/
[Email protected] ~]# LN-SV mysql-5.6.36-linux-glibc2.5-x86_64/mysql
[[Email protected] ~]# CD MySQL
[Email protected] ~]# chown-r mysql:mysql.
[Email protected] ~]# scripts/mysql_install_db--user=mysql--datadir=/data/mysqldata/
[Email protected] ~]# chown-r root.
4 , for MySQL To provide a master profile: # The default initialization is / etc under a my.cnf
[Email protected] ~]# cd/usr/local/mysql/support-files [[email protected] ~]# CP my-default.cnf/etc/my.cnf
5. provide sysv for MySQL Service script:
[Email protected] ~]# cd/usr/local/mysql [[email protected] ~]# CP support-files/mysql.server/etc/rc.d/ Init.d/mysqld
[Email protected] ~]# Ldconfig
9, modify the PATH environment variable, so that the system can directly use mysql related commands.
[Email protected] ~]# echo "path= $PATH:/usr/local/mysql/bin" >/etc/profile.d/mysql. SH [Email protected] ~]# source/etc/profile.d/mysql. SH
provide a configuration file for the MySQL service /etc/my.cnf , the contents are as follows:
[Email protected] ~]# VIM/ETC/MY.CNF
[Client]
Port = 3306
Socket =/tmp/mysql.sock
Default-character-set = UTF8
[MySQL]
No-auto-rehash
Default-character-set = UTF8
[Mysqld]
Server-id = 114
Port = 3306
user = MySQL
Basedir =/usr/local/mysql
DataDir =/data/mysqldata
Socket =/tmp/mysql.sock
Default-storage-engine = INNODB
Character-set-server = UTF8
Connect_timeout = 60
Wait_timeout = 18000
Back_log = 500
Event_scheduler = On
to ensure MySQL The service starts normally, please create the relevant directory and give permission according to the above configuration file:
[Email protected] ~]# mkdir -p/data/mysqllog/logs [[email protected] ~]# chown -R Mysql.mysql/dat A/mysqllog/logs
Finally start the service:
[[Email protected] ~]# service mysqld start
Install mysql-5.6.36 on CentOS6.9