Environment:
Linux CentOS Release 6.9 CentOS7 min applies
MySQL Community Server 5.6.37
Installation
1. Create groups and users
1 [[email protected] ~]# groupadd mysql2 [[email protected] ~]# useradd-r-g MySQL MySQL
2. Upload the downloaded MySQL package to the/usr/local directory
Attached: https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.37-linux-glibc2.12-x86_64.tar.gz
3. Rename the package decompression
1 tar -zxv-f mysql-5.6. Panax Notoginseng-LINUX-GLIBC2. -x86_64. Tar 2mv mysql-5.6. Panax Notoginseng-LINUX-GLIBC2. -x86_64 MySQL
4. Authorization
chown -R mysql:mysql MySQL
5, see if there is my.cnf if there is no copy support-files/under the my-default.cnf, modify the MY.CNF
6, check if there are mariadb have the words uninstall off
[Email protected] ~]# Rpm-qa|grep mariadb
Mariadb-libs-5.5.52-1.el7.x86_64
[Email protected] ~]# rpm-e--nodeps mariadb-libs-5.5.52-1.el7.x86_64
7. See if the/etc/my.cnf file is present and delete if it exists
8. Copy the/usr/local/mysql/my.cnf file to the/ETC/MY.CNF
9. Modify the My.cnf file
[MySQL]#set MySQL client default character set defaults-character-set=UTF8 Socket=/var/lib/mysql/Mysql.sock [mysqld] Skip-name-Resolve#Set Port 3306=3306Socket=/var/lib/mysql/Mysql.sock#set the installation directory for MySQL Basedir=/usr/Local/MySQL#set the data storage directory for the MySQL database DataDir=/usr/Local/mysql/Data#Maximum number of connections allowed Max_connections= $#the character set used by the service side defaults to the 8-bit encoded latin1 character Set character-set-server=UTF8#default storage engine that will be used when creating a new table-storage-engine=INNODB Lower_case_table_name=1Max_allowed_packet=16m
10. Go to MySQL installation directory to switch to MySQL user
-bash-4.2$./mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data
11. May error switch to root user execution Yum-y install autoconf
Yum-y Install autoconf
12. Grant/ETC/MY.CNF Maximum Permissions
Chown 777/etc/my.cnf
13. Copy the startup script to the resource directory
[email protected] mysql]# CP./support-files/mysql.server/etc/rc.d/init.d/mysqld
14. Increase Mysqld Execution privileges
15. Adding Mysqld to System services
[Email protected] mysql]# chkconfig--add mysqld
16. Check whether the mysqld is in effect
[Email protected] mysql]# chkconfig--list mysqld
17. Add the MySQL bin directory to the environment variable
and source/etc/profile to bring it into effect.
18. Starting with service mysqld start
Install MySQL under Linux