Mysql – execstop thesql error on stop and restart

kali-linuxmariadbMySQLPHPsql

prerequisite:

  • os: kali-linux 2018.1
  • uname -r: 4.14.0-kali3-amd64
  • mysql version: mysql Ver 15.1 Distrib 10.1.29-MariaDB

problem:
yesterday i had setup an apache server with this help, https://www.tecmint.com/install-wordpress-on-ubuntu-16-04-with-lamp/.
I was able to install wordpress and use it fine.
today I tried to upload a theme and got an error, changed php.ini to allow upto 20Mb, later restarted pc.

tried installing the theme again but got this error "Your PHP installation appears to be missing the MySQL extension which is required by WordPress."

systemctl restart mysql.service (also for stop and start)
mysqladmin shutdown -p
killall mysql

i tried the following with the outputs given below;

output from systemctl status mysql.service kinda bothers me, since it only appears like this after systemctl restart mysql.service and always afterwards

 mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql; generated; vendor preset: disabled)
   Active: active (exited) since Tue 2018-02-13 13:01:42 EAT; 16min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 10670 ExecStop=/etc/init.d/mysql stop (code=exited, status=1/FAILURE)
  Process: 10732 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)

Feb 13 13:01:42 user systemd[1]: Starting LSB: Start and stop the mysql database server daemon...
Feb 13 13:01:42 user mysql[10732]: Starting MariaDB database server: mysqld already running.
Feb 13 13:01:42 user systemd[1]: Started LSB: Start and stop the mysql database server daemon.

stopping the service with

mysqladmin shutdown -p

[and related commands for stopping the services, eg pkill, killall] after which

systemctl status mysql.service

gives

 mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql; generated; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2018-02-13 13:41:49 EAT; 2min 24s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 11572 ExecStop=/etc/init.d/mysql stop (code=exited, status=1/FAILURE)
  Process: 11487 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)
    Tasks: 0 (limit: 4915)
   CGroup: /system.slice/mysql.service

would appreciate your help in fixing this. thanks.

Best Answer

If you shut down MySQL by killing it directly, then when systemd tries to run the script to stop MySQL, it returns failure because MySQL wasn't running.

You can ignore this, but in normal circumstances you would never kill the MySQL process. You also would not use mysqladmin shutdown on a systemd-managed service. Use systemd to start and stop it instead.