1个回答
展开全部
可以使用mysql_multi在一台主机上启动多实例数据库,用一个配置文件即可,要指定以下内容(不同实例的配置,根据自己的实际情况配置):
[mysqld_multi]
mysqld = /usr/local/mysql/bin/mysqld_safe #根据自己的mysql目录配置
mysqladmin = /usr/local/mysql/bin/mysqladmin
[mysqld1]
port = 3306
socket = /tmp/mysql3306.sock
basedir=/usr/local/mysql
datadir=/mysqldata/data3306
[mysqld2]
port = 3307
socket = /tmp/mysql3307.sock
basedir=/usr/local/mysql
datadir=/mysqldata/data3307
之后再初始化数据库的目录:
cd /usr/local/mysql/;./scripts/mysql_install_db --datadir=/mysqldata/data3307/ --user=mysql
cd /usr/local/mysql/;./scripts/mysql_install_db --datadir=/mysqldata/data3306/ --user=mysql
再启动多实例:
/usr/local/mysql/bin/mysqld_multi start 1-2
如何登陆:
本地登陆指定套接字文件即可
mysql -S /tmp/mysql3306.sock
如果自己还玩儿不会加这个群问371561513
[mysqld_multi]
mysqld = /usr/local/mysql/bin/mysqld_safe #根据自己的mysql目录配置
mysqladmin = /usr/local/mysql/bin/mysqladmin
[mysqld1]
port = 3306
socket = /tmp/mysql3306.sock
basedir=/usr/local/mysql
datadir=/mysqldata/data3306
[mysqld2]
port = 3307
socket = /tmp/mysql3307.sock
basedir=/usr/local/mysql
datadir=/mysqldata/data3307
之后再初始化数据库的目录:
cd /usr/local/mysql/;./scripts/mysql_install_db --datadir=/mysqldata/data3307/ --user=mysql
cd /usr/local/mysql/;./scripts/mysql_install_db --datadir=/mysqldata/data3306/ --user=mysql
再启动多实例:
/usr/local/mysql/bin/mysqld_multi start 1-2
如何登陆:
本地登陆指定套接字文件即可
mysql -S /tmp/mysql3306.sock
如果自己还玩儿不会加这个群问371561513
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询