Tuesday, September 14th, 2010
I’m used to doing some things the old fashioned way. Using /etc/init.d/mysql restart. Doing so in Ubuntu gave me this:
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql restart
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the restart(8) utility, e.g. restart mysql
Rather than invoking init scripts through /etc/init.d, use the service(8)utility, e.g. service mysql restart
Since the script you are attempting to invoke has been converted to anUpstart job, you may also use the restart(8) utility, e.g. restart mysql
Now, I tried this new way of doing things and it just hung, no response, nothing in the error logs, nothing. A little google search brought me to a forum post (and solution) by Thomas Gutzmann that was very useful and worked beautifully. Below are the steps provided and the associated forum link for reference. Thanks Thomas.
http://ubuntuforums.org/showthread.php?t=1475798
After upgrading to Ubuntu 10.04, MySQL wouldn’t start up again. Several solutions had been discussed in this forum, but none of them would fit in my situation. I finally found a way which I want to outline here.
Symptom: “start mysql” or “service mysql start” (as root) hangs.
Reason: In /etc/init/mysql.conf, there is an infinite loop in the post-start script due to an incomplete migration of MySQL.
Fix: Create an additional user in the schema “mysql”.
Steps:
1. Look at /etc/mysql/debian.cnf. Extract the cryptic, bun unencrypted password for user “debian-sys-maint”.
2. Start mysql using “/usr/sbin/mysqld” (as root).
3. Log in as mysql (or “su – mysql”).
4. Connect to mysql as root: “mysql -u root –password=XXXX”.
5. Create the user “debian-sys-maint”, using the password retrieved in step 1: “create user ‘debian-sys-maint’ identified by ‘btIgH81mUXcfZdCQ’;”.
6. Get the pid of mysqld: “ps ax | grep -i mysqld”. Example: “3024 ? Ssl 0:00 /usr/sbin/mysqld”
7. Kill this process: “kill -5 3024″.
8. Start mysql (as root): “start mysql”. Eventually you see an error message that mysql is already running; this can happen if you tried the command before and cancelled it with control-c. In this case, enter “stop mysql” and “start mysql”.
9. Reboot to see if MySQL starts up automatically.
10. If the automatic startup still fails, you may follow the advice from a different thread: change the start condition in /etc/init/mysql.conf to “start on (net-device-up IFACE=ethX)”, where “X” is the interface you have mysql bound to, e.g. ETH1.
11. In my case, I had another very specific problem: I’m running Ubuntu in a VM with several virtual disks which were not mounted yet when the network was up. Quite tricky to figure out. So I modified the start condition to “start on (net-device-up IFACE=eth1 and stopped mountall)”, and now everything is fine.
| Posted in Uncategorized | No Comments »