运行两个mysql示例

mv1qrgav  于 2021-06-25  发布在  Mysql
关注(0)|答案(1)|浏览(353)

我尝试在同一台计算机上运行两个mysql示例,并按如下方式设置my.cnf文件:

[mysqld1]
user        = mysql
pid-file    = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
port        = 3307
datadir     = /var/lib/mysql

[mysqld2]
user        = mysql
pid-file    = /var/run/mysqld/mysqld2.pid
socket      = /var/run/mysqld/mysqld2.sock
port        = 3308
datadir     = /var/lib/mysql2

当我执行mysqld\u multi start命令时,会出现以下错误:
在/var/lib/mysql2中安装新数据库
2016-10-06 17:47:23[警告]mysql\u install\u db已弃用。请考虑切换到mysqld--initialize 2016-10-06 17:47:23[错误]找不到服务器可执行文件(mysqld)。
致命错误:尝试在组[mysqld2]下启动mysqld,但找不到或无法创建数据目录。使用的数据目录:/var/lib/mysql2
我怎样才能解决这个问题?
注意:mysql运行在ubuntu16.0.4和mysql 5.7上

qeeaahzv

qeeaahzv1#

我知道一个问题。

2016-10-06 17:47:23 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize 2016-10-06 17:47:23 [ERROR] Can't locate the server executable (mysqld).

请输入/use/bin/mysqld\u multi文件中的343到344和345行

343   #$install_cmd="/usr/bin/mysql_install_db ";
344   $install_cmd="/usr/bin/mysqld ";
345   $install_cmd.="--initialize ";
346   $install_cmd.="--user=mysql ";
347   $install_cmd.="--datadir=$datadir";

相关问题