PDA

View Full Version : [ubuntu] can't shutdown mysqld



occams_beard
February 14th, 2010, 12:17 AM
When ever I reboot or shutdown, I always get the message.



Mysql shutdown..... Fail!


It always just refuses to shutdown.

I can not even stop it manually with



sudo /etc/init.d/mysql stop


It just returns [fail]

Today, there was an apt update of mysql and that failed too, because mysqld would not shut down. I had to forcefully stop mysqld with sudo kill in order to install the update.


Any ideas why this would be or how I can fix it?

Thanks.

Shpongle
February 14th, 2010, 01:53 AM
try killall mysql , if that doesnt work use top to find the process id (pid) then type kill %(insert pid here)

Edit: sorry i misread it

occams_beard
February 14th, 2010, 08:39 PM
bump.

Still can't figure out what's going wrong, and worry about the DB not getting shut down cleanly...

Where does mysql store it's log files.

jd65pl
February 14th, 2010, 09:35 PM
Logs are in

/var/log/mysql/

cat /var/log/mysql/error.log

mysql should be an upstart job but I doubt stopping it this way will have any impact on what you are seeing

sudo service mysql stop

occams_beard
February 14th, 2010, 09:42 PM
Well, solved this my self. Turns out a while back I had destroyed the debian-sys-maint user account when I imported a DB from a server that was running CentOS.

On Debian systems, this user apparently shuts down the DB, and various other maintenance stuff.

The solution was to simply recreate the user with:



GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '<password>' WITH GRANT OPTION;


Where '<password>' is the value found in /etc/mysql/debian.cnf.

Everything is working peachy again.

Anyway, learned something new :)

RedScourge
March 22nd, 2010, 06:05 PM
You do NOT need to grant all permissions, this is a bad habit to get into from a security standpoint.

All you need to grant is this (as root or whoever):

GRANT SHUTDOWN ON *.* TO 'debian-sys-maint'@'localhost';
GRANT SELECT ON `mysql`.`user` TO 'debian-sys-maint'@'localhost';

Because it needs to shutdown/startup, and does a test select from the users table as a sanity check to ensure the root user exists. This select is usually done by /usr/share/mysql/debian-start.inc.sh which is loaded by /etc/mysql/debian-start