1.yum installing each dependent package
[Email protected] ~]# yum-y install gcc gcc-devel gcc-c++ gcc-c++-devel autoconf* automake* zlib* libxml* ncurses-devel ncurses libgcrypt* libtool* cmake OpenSSL openssl-devel Bison bison-devel Unzip
2. Create MySQL installation directory and database directory
sudo mkdir-p/opt/mysql/database
3. Change the permissions of the MySQL directory for your current user (my username is Colben)
sudo chown colben.colben/opt/mysql
sudo chown colben.colben/opt/mysql/-R
4. Unzip the mysql-5.6.21.tar.gz source package
sudo tar zxvf ~/download/mysql-5.6.21.tar.gz-c/usr/local/src/
sudo chown colben.colben/usr/share/src/mysql-5.6.21
sudo chown colben.colben/usr/share/src/mysql-5.6.21/-R
5. Download the Gmock-1.6.0.zip and extract it to the Source_downloads directory in the source code.
Http://files.cnblogs.com/colben/gmock-1.6.0.zip
Unzip ~/Download/gmock-1.6.0.zip
MV gmock-1.6.0/usr/local/src/mysql-5.6.21/source_downloads/
cd/usr/local/src/mysql-5.6.21/source_downloads/gmock-1.6.0
./configure
Make
Cd.. /.. /
6. Compiling the installation
CMake \-dcmake_install_prefix=/opt/mysql \-dmysql_datadir=/opt/mysql/database \-dwith_myisam_storage_engine=1 \- dwith_innobase_storage_engine=1 \-dwith_memory_storage_engine=1 \-dwith_archive_storage_engine=1 \-DWITH_ partition_storage_engine=1 \-dwith_blackhole_storage_engine=1 \-dwith_readline=1 \-DENABLE_DOWNLOADS=1 \-DENABLED_ local_infile=1 \-dmysql_unix_addr=/var/lib/mysql/mysql.sock \-dmysql_tcp_port=3306 \-DEXTRA_CHARSETS=all \- Ddefault_charset=utf8 \-ddefault_collation=utf8_general_ci
Make
Make install
7. Create a configuration file
Cp/opt/mysql/support-files/my-default.cnf/opt/mysql/my.cnf
8. Initializing the database
/opt/mysql/scripts/mysql_install_db--user=colben--basedir=/opt/mysql--datadir=/opt/mysql/database # Note that the colben here will be changed to their username.
9. Start the MySQL service
/opt/mysql/support-files/mysql.server start
10. Set the MySQL root user's password
/opt/msql/bin/mysqladmin-u Root Password 123456 #修改mysql数据库的root账户密码是123456
11. Delete the MySQL account with a blank password
/opt/mysql/bin/mysql-uroot-p
Prompt for password, enter the root password we set in the previous step: 123456
Go to MySQL Command interface:
Mysql>use MySQL;
Mysql>delete from user where password= "";
Mysql>flush privileges;
Mysql>exit
End
centos6.5 Source code compilation mysql5.6.21