您好,登录后才能下订单哦!
多套后台进程+线程+内存结构
多个端口,多个配置文件,多个日志文件,多个socket,多个server_id
多套数据
##PS:安装多实例前,首先确保MySQL数据库已安装,mysql安装参考:https://blog.51cto.com/zhuzhiwei/2140683
mkdir -p /data/330{7..9} #<=====创建多个目录
================第一个实例===================
vim /data/3307/my.cnf
[mysqld]
basedir=/application/mysql
datadir=/data/3307/data
socket=/data/3307/mysql.sock
log-error=/data/3307/mysql.log
log-bin=/data/3307/mysql-bin
server-id=7
port=3307
[client]
socket=/data/3307/mysql.sock
================第二个实例===================
vim /data/3308/my.cnf
[mysqld]
basedir=/application/mysql
datadir=/data/3308/data
socket=/data/3308/mysql.sock
log-error=/data/3308/mysql.log
log-bin=/data/3308/mysql-bin
server-id=8
port=3308
[client]
socket=/data/3308/mysql.sock
================第三个实例===================
vim /data/3309/my.cnf
[mysqld]
basedir=/application/mysql
datadir=/data/3309/data
socket=/data/3309/mysql.sock
log-error=/data/3309/mysql.log
log-bin=/data/3309/mysql-bin
server-id=9
port=3309
[client]
socket=/data/3309/mysql.sock
=========================================
chown -R mysql.mysql /data/330* #<======将3个目录授权给mysql用户
/application/mysql/scripts/mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/data/3307/data
=================================================================================
/application/mysql/scripts/mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/data/3308/data
=================================================================================
/application/mysql/scripts/mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/data/3309/data
=================================================================================
mysqld_safe --defaults-file=/data/3307/my.cnf &
====================================================================
mysqld_safe --defaults-file=/data/3308/my.cnf &
====================================================================
mysqld_safe --defaults-file=/data/3309/my.cnf &
====================================================================
touch /data/3309/mysql.log
touch /data/3308/mysql.log
touch /data/3307/mysql.log
chown -R mysql.mysql /data/330*
再次启动多个实例即可。
===============进入实例===============================
mysql -s /data/3307/mysql.sock #首次进入无密码
mysql -s /data/3308/mysql.sock
mysql -s /data/3309/mysql.sock
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。