domoindal
domoindal

Reputation: 1523

Running two instances of mysql

I'm trying to run two instances of MySQL on the same machine and setup my.cnf file as the following:

[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

When I execute mysqld_multi start command, it arises the following error:

Installing new database in /var/lib/mysql2

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).

FATAL ERROR: Tried to start mysqld under group [mysqld2], but no data directory was found or could be created. data directory used: /var/lib/mysql2

How can I solve this?

Note: MySQL is running on Ubuntu 16.0.4 and MySQL 5.7

Upvotes: 1

Views: 5251

Answers (1)

TIGERB
TIGERB

Reputation: 51

I know the one question.

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).

Please vim the line 343 to 344&345 in the file /use/bin/mysqld_multi

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";

Upvotes: 2

Related Questions