源码包编译安装MySQL 5.6脚本
源码包编译安装MySQL5.6脚本,一个机器安装两个MySQL数据库,编译时指定端口,安装路径和socket文件位置。安装完成的MySQL安装文
源码包编译安装MySQL5.6脚本,一个机器安装两个MySQL数据库,编译时指定端口,安装路径和socket文件位置。
安装完成的MySQL安装文件可以打包复制到别的机器使用,在别的机器使用时候只需要初始化,,给相关目录权限既可以。
安装3306端口的MySQL:
#!/bin/bash
groupadd mysql
useradd -g mysql mysql -s /sbin/nologin
mkdir /data/3306
chown -R mysql.mysql /data/3306
chmod 755 /data/3306
#mount -o loop /tmp/turbolinux12.iso /mnt/
yum -y install make gcc-c++ cmake bison-devel ncurses-devel openssl openssl-devel bison
tar zxf /tmp/mysql-5.6.16.tar.gz -C /usr/local/src/
mv /usr/local/src/mysql-5.6.16/ /usr/local/src/mysql-master
#read-n1 var 按任意键继续
read -n1 var
cd /usr/local/src/mysql-master
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-master/ \
-DMYSQL_DATADIR=/data/3306/data \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_UNIX_ADDR=/var/run/mysqld/mysql-master.sock \
-DSYSCONFDIR=/usr/local/mysql-master \
-DDEFAULT_CHARSET=gbk \
-DDEFAULT_COLLATION=gbk_chinese_ci \
-DWITH_EXTRA_CHARSETS=ALL \
-DMYSQL_USER=mysql
read -n1 var
make
read -n1 var
make install
read -n1 var
chown -R mysql.mysql /usr/local/mysql-master
/usr/local/mysql-master/scripts/mysql_install_db --basedir=/usr/local/mysql-master --datadir=/data/3306/data --user=mysql
cp /usr/local/mysql-master/support-files/mysql.server /etc/init.d/mysqld-master
read -n1 var
chmod +x /etc/init.d/mysqld-master
chkconfig --add mysqld-master
chkconfig mysqld-master on
/etc/init.d/mysqld-master start
安装3307端口的mysql:
#!/bin/bash
groupadd mysql
useradd -g mysql mysql -s /sbin/nologin
mkdir /data/3307
chown -R mysql.mysql /data/3307
chmod 755 /data/3307
#mount -o loop /tmp/turbolinux12.iso /mnt/
yum -y install make gcc-c++ cmake bison-devel ncurses-devel openssl openssl-devel bison
tar zxf /tmp/mysql-5.6.16.tar.gz -C /usr/local/src/
mv /usr/local/src/mysql-5.6.16/ /usr/local/src/mysql-slave
read -n1 var
cd /usr/local/src/mysql-slave
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-slave/ \
-DMYSQL_DATADIR=/data/3307/data \
-DMYSQL_TCP_PORT=3307 \
-DMYSQL_UNIX_ADDR=/var/run/mysqld/mysql-slave.sock \
-DSYSCONFDIR=/usr/local/mysql-slave \
-DDEFAULT_CHARSET=gbk \
-DDEFAULT_COLLATION=gbk_chinese_ci \
-DWITH_EXTRA_CHARSETS=ALL \
-DMYSQL_USER=mysql
read -n1 var
make
read -n1 var
make install
read -n1 var
chown -R mysql.mysql /usr/local/mysql-slave
/usr/local/mysql-slave/scripts/mysql_install_db --basedir=/usr/local/mysql-slave --datadir=/data/3307/data --user=mysql
cp /usr/local/mysql-slave/support-files/mysql.server /etc/init.d/mysqld-slave
read -n1 var
chmod +x /etc/init.d/mysqld-slave
chkconfig --add mysqld-slave
chkconfig mysqld-slave on
/etc/init.d/mysqld-slave start
《MySQL权威指南(原书第2版)》清晰中文扫描版 PDF
推荐阅读
-
Linux下MySQL 5.5.8 源码编译安装记录分享
-
RPM方式安装MySQL5.6源码
-
CentOS 7.2 Yum编译安装MySQL 5.6
-
Linux下MySQL 5.5.8 源码编译安装记录分享
-
RPM方式安装MySQL5.6源码
-
CentOS 7.2 Yum编译安装MySQL 5.6
-
MySQL 5.7.13 源码编译安装配置方法图文教程
-
centos编译安装mysql 5.6及安装多个mysql实例详解
-
MySQL 5.7.13 源码编译安装配置方法图文教程
-
CentOS 7.x编译安装Nginx1.10.3+MySQL5.7.16+PHP5.2 5.3 5.4 5.5 5.6 7.0 7.1多版本全能环境