MySQL Won’t Start After Update

MySQLsystemd

I just finished that Debian upgrade to Stretch, and as a result, we had an issue with our mailserver (postfix/courier/saslauthd/mysql – nothing was authenticating). As a result, I did the forbidden, and rebooted the server. Now, I can't get MySQL to come back up. The systemd error is irritatingly vague and not much to search based on. This is all I've got:

$ sudo service mysql status
● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql; generated; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2017-08-29 19:13:26 UTC; 2min 49s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 18202 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
  Process: 19651 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

Aug 29 19:12:55 server.name.tld systemd[1]: Starting LSB: Start and stop the mysql database server daemon...
Aug 29 19:12:55 server.name.tld su[19677]: Successful su for mysql by root
Aug 29 19:12:55 server.name.tld su[19677]: + ??? root:mysql
Aug 29 19:12:55 server.name.tld su[19677]: pam_unix(su:session): session opened for user mysql by (uid=0)
Aug 29 19:13:26 server.name.tld /etc/init.d/mysql[19977]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
Aug 29 19:13:26 server.name.tld mysql[19651]: Starting MySQL database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed!
Aug 29 19:13:26 server.name.tld systemd[1]: mysql.service: Control process exited, code=exited status=1
Aug 29 19:13:26 server.name.tld systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
Aug 29 19:13:26 server.name.tld systemd[1]: mysql.service: Unit entered failed state.
Aug 29 19:13:26 server.name.tld systemd[1]: mysql.service: Failed with result 'exit-code'.

The only addition syslog has on top of that is mysqladmin not being able to connect to the socket. Which is just because MySQL isn't actually starting in the first place.

I've checked to make sure it can write to /var/run/mysqld, as well as the appropriate logging directories. The MySQ: logs aren't actually of any help; nothing has been written to any of them since the shutdown messages when I rebooted. I've also double checked that directory entries in /etc/mysql/my.cnf are all where they're supposed to be. I've also had myisam-recover-options and key_buffer_size variable names updated from the old version.

I can start mysql manually with sudo mysqld, the process will run and the socket file will show in the correct place, but nothing actually happens. All I get in the console is:

2017-08-29 19:35:03 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-08-29 19:35:03 0 [Warning] Insecure configuration for --secure-file-priv: Data directory is accessible through --secure-file-priv. Consider choosing a different directory.
2017-08-29 19:35:03 0 [Note] mysqld (mysqld 5.6.36-1~dotdeb+7.1-log) starting as process 24760 ...

Pre-edit: Eventually (like 5+mins) it gets back to the command prompt with MySQL running, but it doesn't seem to stay running. After a while, I'll come back to find it just… stopped. MySQL logs still show nothing, can't find anything in syslog about it. I gave up, backed up the DBs and reinstalled MySQL (just the actual server package, not -common, as it was gonna remove a bunch of packages I didn't wanna risk). After reinstalling… it did exactly the same as before.

Unfortunately, even when MySQL is temporarily running, saslauthd still won't auth against the DB for postfix/courier (which it did fine before). I guess that's for another post once I get MySQL running properly again.

I'm kinda at the end of my wits at the end of a very long day.

Edit: Solution in comments: MySQL Won't Start After Update

Best Answer

The version of MySQL in Debian 8 "Jessie" is 5.5. When installing, most users will install the mysql-server package, which depends on the mysql-server-5.5 package. In Debian 9 "Stretch" the mysql-server package depends on a new package called default-mysql-server. This package in turn depends on mariadb-server-10.1. There is no default-mysql-server package in Jessie.

Read article of upgrade mysql to mariadb at Moving from MySQL to MariaDB in Debian 9