CENTOS7 binary installation package installation mysql5.6
First, download mysql5.6 binary installation package
http://mirrors.sohu.com/mysql/MySQL-5.6/
such as: mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz
Second, install mysql5.6 (installed in/data/mysql56)
(1), create MySQL user account
> Useradd-s/sbin/nologin-m mysql
(2), unzip the compressed package
> Tar XF mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz
(3), renaming
> MV mysql-5.6.34-linux-glibc2.5-x86_64 mysql56
(4), copy the configuration file
> cp/data/mysql56/support-files/my-default.cnf/etc/my.cnf
(* binary installation, default Config file in/etc/my.cnf)
(5), initialize the database
> Chown-r mysql.mysql/data/mysq56>/data/mysql56/scripts/mysql_install_db--user=mysql--basedir=/data/ Mysql56--datadir=/data/mysql56/data
If the following information appears
FATAL Error:please Install the following Perl modules before Executingdata::D umper
> yum-y Install autoconf
The Data:dumper module is installed when this package is installed
Third, configure and start MySQL
> cp/data/mysql56/support-files/mysql.server/etc/init.d/mysqld> chmod 755/etc/init.d/mysqld
(* Note that the default path for MySQL binary installation is/usr/local/mysql,/usr/local/mysql need to be replaced in the startup script)
> sed-i ' s#/usr/local/mysql#/data/mysql56#g '/data/mysql56/bin/mysqld_safe/etc/init.d/mysqld
Start MySQL
> Service mysqld Start
Iv. adding self-priming
> Chkconfig--add mysqld> chkconfig mysqld on> chkconfig--list mysqld
V. Configuring Environment variables
> Echo ' export path=/data/mysql56/bin: $PATH ' >>/etc/profile> source/etc/profile
Vi. Modify the MySQL password (mysql5.6 install default root password is empty)
> mysqladmin-u root password ' 123456 '
Vii. clean up useless MySQL users and libraries
Log in to MySQL
> mysql-uroot-p
Query users
> select User,host from Mysql.user;
As shown below
+------+-----------------------+| user | Host |+------+-----------------------+| root | 127.0.0.1 | | root |:: 1 | | | localhost | | root | localhost | | | localhost.localdomain | | root | localhost.localdomain |+------+-----------------------+
> Drop User "root" @ ":: 1";> drop user "@" localhost ";> drop user" @ "localhost.localdomain";> drop User "root" @ "Localhost.localdomain";
Delete Useless libraries
> drop database test;
CENTOS7 binary installation package installation mysql5.6