Install each dependency package in 1yum [root @ WebServer ~] Yum-yinstallgccgcc-develgcc-c43; 43; gcc-c43; 43;-develautoconf * automake * zlib * libxml * ncurses-develncurseslibgcrypt * libt 1. yum install various dependent packages
[Root @ WebServer ~] # Yum-y install gcc-devel gcc-c ++-devel autoconf * automake * zlib * libxml * ncurses-devel ncurses libgcrypt * libtool * cmake openssl -devel bison-devel unzip
2. create the mysql installation directory and Database Directory
mkdir -p /opt/mysql/datamkdir -p /opt/mysql/etcmkdir -p /opt/mysql/log
3. change the mysql directory permission to your current user (my user name is mysql)
Chown mysql. mysql/opt/mysql
Chown mysql. mysql/opt/mysql/data-
4.decompress the mysql-5.6.21.tar.gz source code package
Tar zxvf ~ /Download/mysql-5.6.21.tar.gz-C/usr/local/src/chown mysql. mysql/usr/share/src/mysql-5.6.21hown mysql. mysql/usr/share/src/mysql-5.6.21/-R
5.download gmock-1.6.0.zip and decompress it to the source_downloads directory in the source code.
Http://bbs.ithome.com/forum.php? Mod = attachment & aid = NTk1MjYwfGNkYzNjZDM0fDE0MTM4NTU1MzR8MjA5NDI5Nnw2Mzg1NTA % 3 Dunzip ~ /Download/gmock-1.6.0.zipmv 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./configuremakmcm ../../
6. Compile and install
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_cimakemake install
7. create a configuration file
cp /opt/mysql/support-files/my-default.cnf /opt/mysql/etc/my.cnf[root@master support-files]# cat /opt/mysql/etc/my.cnf[mysqld]datadir = /opt/mysqldatadir = /opt/mysql/data#socket = /tmp/mysql.socksocket = /opt/mysql/data/mysql.sock#log = /opt/mysql/log/mysql.logpid-file = /opt/mysql/data/mysql.piduser = mysqlport = 3306#tmpdir = /tmplog-error = /opt/mysql/log/mysql.err[client]socket = /opt/mysql/data/mysql.sock
8. initialize the database
/Opt/mysql/scripts/mysql_install_db -- user = mysql -- basedir =/opt/mysql -- datadir =/opt/mysql/data
9. create shell scripts for MySQL database management
Root @ master support-files] # cp mysql. server/etc/init. d/mysql [root @ master support-files] # chmod + x/etc/init. d/mysql [root @ master support-files] # service mysql startStarting MySQL .. [OK] [root @ master support-files] #
10. set the password of the MySQL root user
/Opt/msql/bin/mysqladmin-u root password 123123 # Change the root account password of the mysql database to 123123
11. log on to mysql
[root@master support-files]# mysql -uroot -p123123Warning: Using a password on the command line interface can be insecure.Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.6.21 Source distributionCopyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.