我需要帮助 。 在端口3306上的mysql和在端口3307上的mysql2。
我将my.cnf复制到my2.cnf
我在my2.cnf中添加了以下内容:
datadir = / var / lib / mysql2 port = 3307
cp /etc/init.d/mysql /etc/init.d/mysql2
添加到vi /etc/init.d/mysql2中的第138行:
–port = *)port = echo "$arg" | sed -e 's/^[^=]*=//' echo "$arg" | sed -e 's/^[^=]*=//' ;;
编辑的行215:
CONF =的/ etc / my2.cnf
第257行添加-c标志:
parse_server_arguments $print_defaults $extra_args mysqld server mysql_server mysql.server -c/etc/my2.cnf
在第284行将端口参数添加到mysql_safe命令:
$ bindir / mysqld_safe –defaults-file = / etc / my2.cnf –datadir =“$ datadir”–pid-file =“$ mysqld_pid_file_path”–port =“$ port”–socket =“$ datadir” /mysql2.sock $ other_args> / dev / null 2>&1&
将服务器添加到启动列表中
chkconfig –add mysql2 chkconfig mysql2 –level 2345 on
目前当我重新启动系统并检查状态。 我得到:
[root @ localhost〜]#服务mysql状态
错误! MySQL没有运行,但locking文件(/ var / lock / subsys / mysql)存在
[root @ localhost〜]#服务mysql2状态
错误! MySQL没有运行,但locking文件(/ var / lock / subsys / mysql)存在
[root @ localhost〜]#服务mysql2启动
启动MySQL …成功!
[root @ localhost〜]#服务mysql启动
启动MySQL ……成功!
我做错了什么或者我需要做什么来让两个启动启动
atuomatically? 请帮忙。
打开文件/etc/init.d/mysql /etc/init.d/mysql2并find以下部分
# Lock directory for RedHat / SuSE. lockdir='/var/lock/subsys' lock_file_path="$lockdir/mysql"
将lock_file_path="$lockdir/mysql"更改为lock_file_path="$lockdir/mysql2"
应该解决这个问题:)