Installation of MySQL 5.6:
1, install the dependent library environment in advance.
Yum install-y make Bison cmake gcc-c++ ncurses ncurses-devel git
2, download unzip.
wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.31.tar.gz
TAR-ZXVF mysql-5.6.31.tar.gz
CD mysql-5.6.31
3, create MySQL user datadir
Groupadd MySQL
Useradd-g mysql-s/sbin/nologin MySQL
Mkdir-p/data/mysql
Chown Mysql:mysql/data/mysql
4, pre-compilation environment configuration (CMake)
CMake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/data/mysql-ddefault_charset=utf8-ddefault_collation= Utf8_general_ci-dwith_extra_charsets:string=all-dwith_debug=0-dwith_ssl=yes-dwith_readline=1-denabled_local_ Infile=1
There is an error here, guess what library file must be missing. The prompt is then found in the error message:
--Openssl_include_dir = Openssl_include_dir-notfound
So I installed Yum install-y openssl-devel
Again cmake discovery or error, OH, remember, CMakecache.txt file has not been deleted. RM-RF CMakecache.txt Continue CMake there is no error.
5,make
6, make install
7,CD to Basedir, copy the configuration file, and initialize MySQL.
Cd/usr/local/mysql
Chown-r Mysql/usr/local/mysql
Custom Create/ETC/MY.CNF, the content is in the comment description.
./scripts/mysql_install_db--user=mysql--datadir=/data/mysql
8, copy the startup script and add to the list of services, boot up.
CP Support-files/mysql.server/etc/init.d/mysqld
Vim/etc/init.d/mysqld specifying directories for Basedir and DataDir
chmod 755/etc/init.d/mysqld
Chkconfig--add mysqld
Chkconfig mysqld on
/etc/init.d/mysqld start
9, adding environment variables
echo "path= $PATH:/usr/local/mysql/bin" >/etc/profile.d/mysql.sh
Source/etc/profile
Note: In fact, the 5.6 version and the 5.5 version is no different, but more dependent on a few library files. There is also a support-files directory is no my-large.cnf and other files, only a my-defalut.cnf
We can manually re-edit the/ETC/MY.CNF
Add the following information:
[Client]
Default-character-set=utf8
[Mysqld]
port=3306
Basedir=/usr/local/mysql
Datadir=/data/mysql
Socket=/data/mysql/mysql.sock
User=mysql
Symbolic-links=0
Character-set-server=utf8
[Mysqld_safe]
Log-error=/data/logs/mysql/mysqld.log can be.
MySQL 5.6