MySQL will not shut down
I recently posted about not being able to get MySQL to run after I upgraded the web server from Ubuntu 8.10 to 9.10. That problem was resolved by commenting out "skip-bdb" in my.cnf.
I have since moved on to begin upgrading the backup server from Ubuntu 8.10 to 9.10. Now, I have the opposite problem. I cannot get MySQL to stop so that I can begin the upgrade.
I've tried
/etc/init.d/mysql stop
but MySQL keeps on going.
I've tried
killall mysql
and get returned "no process killed."
Each time I attempt to run
apt-get upgrade
I get the following error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
apache2 apache2-mpm-prefork apache2-utils apache2.2-common dhcp3-client
dhcp3-common libapache2-mod-php5 libcups2 libcupsimage2 libexpat1 libkrb53
libpng12-0 libpq5 libssl0.9.8 libthai-data libthai0 mysql-server
mysql-server-5.0 openssl php5 php5-cli php5-common php5-curl php5-gd
php5-mysql python2.5 python2.5-minimal sudo tzdata
29 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
Need to get 0B/43.9MB of archives.
After this operation, 53.2kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Preconfiguring packages ...
(Reading database ... 18393 files and directories currently installed.)
Preparing to replace mysql-server 5.0.67-0ubuntu6 (using .../mysql-server_5.0.67-0ubuntu6.1_all.deb) ...
* Stopping MySQL database server mysqld
...fail!
invoke-rc.d: initscript mysql, action "stop" failed.
invoke-rc.d returned 1
There is a MySQL server running, but we failed in our attempts to stop it.
Stop it yourself and try again!
dpkg: error processing /var/cache/apt/archives/mysql-server_5.0.67-0ubuntu6.1_all.deb (--unpack):
subprocess pre-installation script returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/mysql-server_5.0.67-0ubuntu6.1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Can anyone point me in the right direction to a solution?
3 Replies
ps -A | grep mysql
grab the pids then run
kill pid (replace pid with the pids you got) do it for each process.
If kill pid doesn't work use
kill -9 pid (where pid is the id of the process)
You must run mysqlcheck on restarting your server after running kill -9 since it kills and doesn't allow for a clean shutdown.
Remember it may take a few seconds for mysql to shutdown cleanly.
I had to use kill-9 on a mysqld process, but after that, I was able to continue on with the upgrade.
Cheers
1)kill the process
2)upgraded mysql (reinstall should work as well just need to keep conf files)
all works