Can't start MySQL/MariaDB after v 142 moved data

Hi! First and foremost, thanks for this fantastic project!

I ran into a problem upon upgrading to v 142. During the installation DB data (MariaDB) was moved to dietpi_userdata and I got a bunch of errors as my user data partition was full. I guess it didn’t move everything, as I have a couple of 0 bytes files in /var/lib/mysql (the symlink that is).

So I decided to move DB data back to the SD card and followed description in this thread.

Now /var/lib/mysql isn’t a symlink anymore, but I can’t start the service, nor do mysql_upgrade to check the tables. Here’s what I get:

root@jpi:/etc/mysql# service mysql start
Job for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details.
root@jpi:/etc/mysql# systemctl status mysql.service
● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql)
   Active: failed (Result: exit-code) since Tue 2017-01-17 13:05:34 CET; 44s ago
  Process: 12915 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

Jan 17 13:05:03 jpi mysqld[13079]: 170117 13:05:03 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
Jan 17 13:05:03 jpi mysqld[13079]: 170117 13:05:03 [ERROR] Unknown/unsupported storage engine: InnoDB
Jan 17 13:05:03 jpi mysqld[13079]: 170117 13:05:03 [ERROR] Aborting
Jan 17 13:05:03 jpi mysqld[13079]:
Jan 17 13:05:03 jpi mysqld[13079]: 170117 13:05:03 [Note] /usr/sbin/mysqld: Shutdown complete
Jan 17 13:05:03 jpi mysqld[13079]:
Jan 17 13:05:34 jpi mysql[12915]: Starting MariaDB database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed!
Jan 17 13:05:34 jpi systemd[1]: mysql.service: control process exited, code=exited status=1
Jan 17 13:05:34 jpi systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
Jan 17 13:05:34 jpi systemd[1]: Unit mysql.service entered failed state.
root@jpi:/etc/mysql# mysql_upgrade
Version check failed. Got the following error when calling the 'mysql' command line client
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")
FATAL ERROR: Upgrade failed

Where do I go from here?

Unfortunately, the patch system assumes you have the required space available for the move (usually < 50MB for SQL datastore). We essentially dont check this, prior to the move as it felt unnecessary. However, clearly not the case :frowning:

So the problem now is during the move, the /var/lib/mysql folder is cleared, to make way for its symlink.

In short, your SQL databases are now potentially lost, or highly corrupted.

We’ll get this fixed for v143, preventing continuation of the move if it fails. Unfortunately, this does not help you now and we can only apologise for that.
https://github.com/Fourdee/DietPi/issues/715

If you have a backup created by dietpi-backup, prior to the update, you will be able to restore system (and the SQL DB) to a previous state:
https://github.com/Fourdee/DietPi/issues/685#issuecomment-270145794

Oh, that’s a bummer, but bugs happen. Luckily, this wasn’t in critical production evnironment.

But what’s the preffered way to get back running? I understand that I’ll end up with a blank database - that’s ok. I had the Lighttpd/MariaDB/Wordpress/phpMyAdmin stack installed. Should I get rid of all the components, or would it be sufficient to uninstall and then reinstall MariaDB only?

Yep, that should do it :slight_smile: