centos7 安装双mysql
之前安装了mysql的5.6.19 现在继续安装此版本主要用于主从复制
1.安装cmake (网上自行下载mysql5.6.19)
wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
tar -xzvf cmake-2.8.10.2.tar.gz
cd cmake-2.8.10.2
./bootstrap
make && make install
安装一下工具
yum -y install wget gcc-c++ ncurses ncurses-devel cmake make perl bison openssl openssl-devel gcc* libxml2 libxml2-devel curl-devel libjpeg* libpng* freetype*
cd mysql-5.6.16
安装mysql
cmake \
-DCMAKE_INSTALL_PREFIX=/data/mysql3307 \
-DMYSQL_UNIX_ADDR=/data/mysql3307/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql3307/data \
-DMYSQL_TCP_PORT=3307 \
-DENABLE_DOWNLOADS=1
初始化mysql
scripts/mysql_install_db –basedir=/usr/local/mysql3307/ –user=mysql
修改mysql的配置
vi /usr/local/mysql3307/etc/my.cnf
[client]
port = 3307 –数据库端口号
socket = /data/mysql3307/mysql.sock –sock文件路径
default-character-set=utf8 –客户端UTF8连接
[mysqld]
port = 3307 –数据库端口号
socket = /data/mysql3307/mysql.sock –sock文件路径
安装mysql的系统服务
support-files/mysql.server /etc/init.d/mysql3307
vi /etc/init.d/mysql3307
basedir=/data/mysql3307
datadir=/data/mysql3307/data
mysqld_pid_file_path=/data/mysql3307/mysql11.pid
保存成功后试试
/etc/init.d/mysql3307 start