1) Preparation before installation
① download MySQL, get the source package from the official website, Http://dev.mysql.com/downloads/mysql
#wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.27.tar.gz
#tar XVF mysql-5.6.27.tar.gz
#cd mysql-5.6.27
② Check if MySQL exists
#rpm-qa | grep MySQL
If it exists, delete it.
RPM-E MySQL//normal Delete mode
RPM-E--nodeps MySQL//Only delete MySQL does not remove dependencies
③ Installation Compilation Environment
#yum-y install make gcc-c++ cmake bison-devel ncurses-devel
2) compile and install MySQL
#cmake \
-dcmake_install_prefix=/usr/local/mysql \
-dmysql_datadir=/usr/local/mysql/data \
-DSYSCONFDIR=/ETC \
-dwith_myisam_storage_engine=1 \
-dwith_innobase_storage_engine=1 \
-dwith_memory_storage_engine=1 \
-dwith_readline=1 \
-dmysql_unix_addr=/var/lib/mysql/mysql.sock \
-dmysql_tcp_port=3306 \
-denabled_local_infile=1 \
-dwith_partition_storage_engine=1 \
-dextra_charsets=all \
-ddefault_charset=utf8 \
-ddefault_collation=utf8_general_ci
After the above configuration succeeds, start compiling the installation, the process will wait a while
#make && make Install
If there is no error in this process, install complete!
3) Configure MySQL
① Configure MySQL users (MySQL) and user groups (MySQL) and their permissions
#grep mysql/etc/passwd
#grep mysql/etc/group
If they are not created, do not exist, create
# Groupadd MySQL
#useradd-g MySQL MySQL
sets/usr/local/mysql users and user groups to MySQL
#chown-R mysql.mysql/usr/local/ MySQL
② initialization database
#cd/usr/local/mysql
#scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/usr/ Local/mysql/data--user=mysql--pid-file=/usr/local/mysql/data/mysql.pid--tmpdir=/tmp/mysql
③ boot MySQL and set to boot from
#cp support-files/mysql.server/etc/init.d/mysql
#chkconfig mysql on
#service mysql start
④ configuration environment variable
Edit /etc/source file, add the above code to the end
Path=/usr/local/mysql/bin: $PATH
Export PATH
Make environment variable effective
#source/etc/profile
⑤ turn on remote access
#mysql
>grant all privileges on *.* to ' root ' @ '% ' identified by ' mypwd123 ' with GRANT OPTION;