Eisler
Eisler

Reputation: 21

Automatically Start Multiple MySQL instances on boot in Ubuntu Trusty 14.04

I'm still learning how to use Linux & MySQL, so please keep answers simple :)

I've been following this tutorial :
http://www.ducea.com/2009/01/19/running-multiple-instances-of-mysql-on-the-same-machine/

Both MySQL instances (the default instance you get on installing MySQL and the new one I created in the aforementioned tutorial) are working correctly.

But, when I boot up my OS, only the first (default instance) starts up, so I have to manually start the second instance.

I've been doing this by running these commands as root:

Start the instance:

mysqld_safe --defaults-file=/etc/mysql2/my.cnf &

Connect:

mysql -h 127.0.0.1 -P 3307

How do I make it so that both of these instances will start at boot time?

Thanks!

Upvotes: 1

Views: 882

Answers (1)

Eisler
Eisler

Reputation: 21

I fixed it by simply running the command at startup by using the solution in this question :

Ubuntu - Run command on start-up with "sudo"

Steps I took :
I added this command to the "/etc/rc.local" file as root: (Before the "exit 0:" line or it will never get executed)

sudo mysqld_safe --defaults-file=/etc/mysql2/my.cnf &

Then I restarted my OS. The new instance is now automatically started :), so now I have both starting on boot!

Though now i wonder.. is this the correct way to handle this issue?

Upvotes: 1

Related Questions