First download the binary installation package:
: https://downloads.mysql.com/archives/community/
Alternate Address: Https://pan.baidu.com/s/1iks660z9Kqu4gVOiAsiERg
1. Install dependent packages
2, upload the binary package decompression, and establish a soft connection without version number
TAR-ZXF mysql-5.6.27-linux-glibc2.5-x86_64.tar.gz
Ln-s/opt/mysql-5.6.27-linux-glibc2.5-x86_64/opt/mysql
3. Create the relevant file directory
Mkdir-p/opt/mysql/{data,sock,binlog,slowlog,pid,errlog}
4, Configuration/etc/my.cnf
Vim/etc/my.cnf
Configuration file:
5. Create a MySQL user and authorize
Groupadd MySQL
Useradd–s/sbin/nologin–g mysql–m MySQL
Chown-r mysql.mysql/opt/mysql/
6. Initialize the database
/opt/mysql/scripts/mysql_install_db--defaults-file=/etc/my.cnf--basedir=/opt/mysql--datadir=/opt/mysql/data-- User=mysql
7. Add the startup script to Init.d
Cp-rp/opt/mysql/support-files/mysql.server/etc/init.d/mysqld
Note the MySQL path specified in the startup script;
8. Then start the database
You can see that port 3306 is up.
9. Configure the global use path for MySQL commands
Then source under to make immediate effect
10. Join open Self-start
Note that CENTOS7 needs to add execution permissions to Rc.local and execute the following command
chmod +x/etc/rc.d/rc.local
Centos7 installing MySQL in a binary way