I'm using MySQL ver 14.14 Distrib 5.7.17 for Linux (x86_64) on Ubuntu 16.04. Whenever I shutdown Ubuntu, it hangs here.

enter image description here

After 10 minutes, it automatically kills the process (my guess). I ran into this problem many times. I did a clean install a few times, it works for a while, but then starts doing the same thing after a few proper shutdowns.

Pressing Ctrl+Alt+Del 7 times consecutively forces a shutdown. Forcing a shutdown like this corrupted my MySQL data. Has anyone else ran into this problem?

  • What happens when you run sudo service mysql stop on the command line? Maybe some script needs some intervention when shutting down the MySQL server. – Patrick Jul 19 '18 at 15:22
  • enter link description here it work for me – Minh Thịnh Đặng Mar 17 '19 at 9:22

Thats because you got problems with timezone settings:

Got the same issue, found a possible explanation: my cloud provider store time in local timezone (earlier than UTC); at startup MySQL boot first, then NTP, which updates the time to UTC; therefore, MySQL literally "started in the future" (sounds interesting).

Running sudo dpkg-reconfigure tzdata should do the trick

Source: https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1600164/comments/11

  • it looks like it doesn't have to be a cloud provider. In our situation, just having the BIOS time set in the future, then installing and running MySQL, then setting the time correctly will also cause the problem. This is on a machine completely disconnected from the network and ntp disbaled. – simon Jan 18 '19 at 18:14

Before shutting down your system, try running this to manually shut down the mysql service.

sudo service mysql stop

Alternatively, write a script to automate the process:

sudo service mysql stop
sudo shutdown -h now

Make sure to mark it as executable. Presuming you saved it as a file named shutdown, run this command:

chmod u+x shutdown

Now you can execute your script.

  • 4
    If MySql server hangs on shutdown, it will also hang on service mysql stop command. Right approach here is to investigate why MySql server hangs. – Vitalii Apr 13 '18 at 10:35

Strangely enough, this worked for me:

sudo dpkg-reconfigure tzdata

possible explanation: my cloud provider store time in local timezone (earlier than UTC); at startup MySQL boot first, then NTP, which updates the time to UTC; therefore, MySQL literally 'started in the future'


Install mysql-client with

apt-get install mysql-client

That should be sufficient.


This happens to me to when I changed the hostname with :

$ sudo hostnamectl set-hostname my-new-hostname

without stopping the mysql server.


Shut down the pc using command- sudo init 0 Though this sounds stupid but yes, it works. It worked for me and even for you too. Actually the server does not stopped because of not being getting the super administrative privileges. So next time shut down using this command.


If it helps anyone else, this is what has resolved the issue for me on Ubuntu 16.04 LTS. Basically delayed the service startup in the mysql.service file under /lib/systemd/system/ I added After=lightdm.service and wants=lightdm.service. (My lightdm.service is itself delayed until domain authentication has taken place) I guess you could use any other service that you know will start later on in the boot. These service files will also shutdown the services when Ubuntu is shutdown in the reverse order.


I tried running sudo apt-get install mysql*, and after the installation finished everything seems to be working nice and easy now... Both following the user680697's nice idea and also shutting down or restarting using GUI capabilities(I'm on Ubuntu Mate 16.04).


This is actually a bug in MySQL.

Please see Bug Report: https://bugs.mysql.com/bug.php?id=93708

To solve this issue, just update your MySQL since the fix is in this update ->

[27 May 2019 13:25] Daniel Price Fixed as of the upcoming 5.7.27, 8.0.17 release, and here's the changelog entry:

Manually changing the system time while the MySQL server was running caused page cleaner thread delays.

credits to Daniel Price.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.