Download the latest MYSQL5.6.SRC.RPM source code package
Extracting source code Packages
Rpm-i mysql-5.6.20-1.rhel5.src.rpm
Cd/usr/src/redhat/specs
RPMBUILD-BP Mysql.spec
The source code is generated below the/usr/src/redhat/build.
3. Installing CMake
Cd/usr/local/src
TAR-ZXVF cmake2.8.5.tar.gz
./configure
Gmake && gmake Install
Yum Install-y OpenSSL Openssl-devel
4. Install MySQL
Groupadd MySQL
useradd-g MySQL MySQL
Mkdir-p/data/mysql
Chown-r Mysql:mysql/data/mysql
TAR-ZXVF mysql5.6.20.tar.gz
CD mysql5.6.20
CMake. \
-dcmake_install_prefix=/usr/local/mysql \
-dmysql_datadir=/data/mysql \
-DSYSCONFDIR=/USR/LOCAL/MYSQL/ETC \
-dmysql_tcp_port=3306 \
-denabled_local_infile=1 \
-dextra_charsets=all \
-ddefault_charset=utf8 \
-DDEFAULT_COLLATION=UTF8_GENERAL_CI \
-dmysql_user=mysql \
-dwith_debug=0 \
-dwith_innobase_storage_engine=1 \
-dwith_ssl=system \
-dwith_embedded_server=1 \
-dwith_readline=1 \
-dwith_ssl=bundled \
-dwith_partition_storage_engine=1
Make && make install
5. Add a service
CP Support-files/mysql.server/etc/init.d/mysqld #复制脚本
chmod +x/etc/init.d/mysqld #增加可执行权限
Chkconfig--add mysqld #增加至sysV服务
Chkconfig mysqld on #开机自启动
6. Modify Mysqld
Vi/etc/init.d/mysqld
Basedir=/usr/local/mysql
Datadir=/data/mysql
7. Modify the configuration file my.cnf
Datadir=/data/mysql
8. Change the password
bin/mysqladmin-u root password ' xxx '
This article is from the "Gu Juncheng Learning Blog" blog, please be sure to keep this source http://gujuncheng.blog.51cto.com/3740198/1559109
installing MySQL under CentOS