1、首先是下载需要安装的MySQL
2、安装支持程序
yum -y install gcc gcc-c++ autoconf automake bison ncurses-devel libtool-ltdl-devel* cmake
3.创建MySQL用户,用户组和相关目录
# mkdir -p /usr/local/mysql # mkdir -p /usr/local/mysql2 # mkdir -p /data/mysql/data # mkdir -p /data/mysql2/data #groupadd mysql #useradd -g mysql mysql # chown -R mysql.mysql /usr/local/mysql # chown -R mysql.mysql /usr/local/mysql2 # chown -R mysql.mysql /data/mysql/data # chown -R mysql.mysql /data/mysql2/data
4.上传介质安装cmake
#wget http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz # tar zxvf cmake-2.8.12.1.tar.gz# cd cmake-2.8.10.2 #./bootstrap # make #make install5.解压、编译、安装MySQL # tar zxvf mysql-5.6.10.tar.gz #cd mysql-5.6.10 #cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_ci \-DWITH_EXTRA_CHARSETS:STRING=all \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_READLINE=1 \-DENABLED_LOCAL_INFILE=1 \-DMYSQL_DATADIR=/data/mysql/data \-DMYSQL_USER=mysql \-DMYSQL_TCP_PORT=3306 #make #make install
6.建立初始数据。
#cd /usr/local/mysql/scripts #./mysql_install_db--basedir=/usr/local/mysql/ --datadir=/data/mysql/data --user=mysql
7、创建My.cnf配置文件和Mysql启动脚本
创建my.cnf配置文件
#cd /usr/local/mysql/support-files #cp my-default.cnf /usr/local/mysql/my.cnf
创建MySQL启动脚本
#cp support-files/mysql.server /etc/init.d/mysqld #chmod +x /etc/init.d/mysqld #vi /usr/local/mysql/my.cnf
# vim /etc/init.d/mysqld2
8.启动服务
service mysqld start
9.解压、编译、安装MySQL
# tar zxvf mysql-5.6.10.tar.gz #cd mysql-5.6.10 #cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql2 \-DMYSQL_UNIX_ADDR=/usr/local/mysql2/mysql.sock \ -DSYSCONFDIR=/usr/local/mysql2 -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \-DWITH_EXTRA_CHARSETS:STRING=all \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_READLINE=1 \-DENABLED_LOCAL_INFILE=1 \-DMYSQL_DATADIR=/data/mysql2/data \-DMYSQL_USER=mysql \-DMYSQL_TCP_PORT=3307 #make #make install
10.建立初始数据。
#cd /usr/local/mysql2/scripts #./mysql_install_db--basedir=/usr/local/mysql2/ --datadir=/data/mysql2/data --user=mysql
11、创建My.cnf配置文件和Mysql启动脚本
创建my.cnf配置文件
#cd /usr/local/mysql2/support-files #cp my-default.cnf /usr/local/mysql2/my.cnf
创建MySQL启动脚本
#cp support-files/mysql.server /etc/init.d/mysqld502 #chmod +x/etc/init.d/mysqld2 #vi /usr/local/mysql2/my.cnf
# vi /etc/init.d/mysqld2
启动
service mysqld2 start
转载于:https://blog.51cto.com/zuoyuezong/1350387