Mysql server not starting

Hello,
I installed mysql-server via apt-get, as I don’t need a LAMP stack, just a mysql server to host the Kodi database of my media players around the house.
All that I get when I try to start the server is the following failure message:

root@DietPi:~# systemctl start mysql
Job for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details.
root@DietPi:~# systemctl status mysql
● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql)
   Active: failed (Result: exit-code) since Mon 2016-03-14 09:50:14 CET; 14min ago
  Process: 8651 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
  Process: 22761 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

Mar 14 09:50:14 DietPi /etc/init.d/mysql[23494]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
Mar 14 09:50:14 DietPi /etc/init.d/mysql[23494]: [61B blob data]
Mar 14 09:50:14 DietPi /etc/init.d/mysql[23494]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Mar 14 09:50:14 DietPi mysql[22761]: Starting MySQL database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed!
Mar 14 09:50:14 DietPi systemd[1]: mysql.service: control process exited, code=exited status=1
Mar 14 09:50:14 DietPi systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
Mar 14 09:50:15 DietPi systemd[1]: Unit mysql.service entered failed state.

Any suggestion on how to solve the issue and where to look to identify the problem?

Thanks,
Federico

Hi Federico,

Thanks for the report.
I’ll need some additional information on your system. Please could you send a bug report:

dietpi-bugreport

Follow the onscreen instructions. You will be provided with a reference Code, please post that in your reply.

Thanks.

Many thanks,
Bug report sent, reference code b827eb49ad2a-0.

Thank you,
Gaggio

Looks like you have a missing folder in /var/log/mysql which prevents mysql service starting as it cant write to the logfile as user mysql.

Please run the following:

mkdir /var/log/mysql
reboot# To update DietPi-Ramlog with the new folder it needs to generate during boot

Once rebooted, please check status again:

systemctl status mysql -l

If the service isnt reporting active (running), please reply with following:

ls -lha /var/log
ls -lha /var/log/mysql

Now active and running!

Thank you very much for your prompt assistance