首页 > 代码库 > 12.cmake安装mysql5.5.56 多实例
12.cmake安装mysql5.5.56 多实例
12.cmake安装mysql5.5.56 多实例
1、必要软件包 | yum -y install ncurses-devel libaio-devel git gcc gcc-c++ bison yum -y install cmake |
2、编译安装 | useradd mysql -s /sbin/nologin -M cd /server/tools/ ###rz mysql-5.5.56.tar.gz到/server/tools目录 tar xf mysql-5.5.56.tar.gz cd mysql-5.5.56 cmake . \ -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.56 \ -DMYSQL_DATADIR=/application/mysql-5.5.56/data \ -DMYSQL_UNIX_ADDR=/application/mysql-5.5.56/tmp/mysql.sock \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EXTRA_CHARSETS=all \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_FEDERATED_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \ -DWITH_ZLIB=bundled \ -DWITH_SSL=bundled \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_EMBEDDED_SERVER=1 \ -DENABLE_DOWNLOADS=1 \ -DWITH_DEBUG=0 make && make install && cd .. && echo $? ln -s /application/mysql-5.5.56/ /application/mysql ll /application/mysql |
3、创建配置文件脚本和对目录授权 | mkdir -p /data/{3306,3307}/data ###把mycnf配置文件和mysql启动脚本 通过rz上传到/data目录 find /data -type f -name "mysql" |xargs chmod 700 chown -R mysql.mysql /data chown -R mysql.mysql /data/ mv /etc/my.cnf{,.bak} |
4、初始化数据库 | /application/mysql/scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/data/3306/data --user=mysql /application/mysql/scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/data/3307/data --user=mysql tree -L 3 /data |
5、启动脚本 | touch /data/3306/mysql_oldboy3306.err chown -R mysql.mysql /data/3306/mysql_oldboy3306.err /data/3306/mysql start netstat -lntup|grep 3306 |
6、新增3308 |
12.cmake安装mysql5.5.56 多实例