Shutdown hangs on "A stop job is running to for Mysql Community Server"

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


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.

./shutdown