Cannot log in to the MySQL server after hosting company restarted my server

Today my hosting company decided to patch their systems due to Meltdown/Spectre and restart all servers.

I had my CentOS 7.2 server running for 280 days with no problems of any kind at all.

But now I can’t use my website anymore, it says “Error establishing a database connection”. When I try to log in to phpMyAdmin with my usual credentials, which I haven’t changed at all, it says “Cannot log in to the MySQL server” without accompanied error number #1045, which it tells usually.

In /var/log/mariadb/mariadb.log I found the following:

170329 18:41:40 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.44-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server
180108 14:25:52 [Note] /usr/libexec/mysqld: Normal shutdown
180108 14:25:54 [Note] Event Scheduler: Purging the queue. 0 events
180108 14:26:16  InnoDB: Starting shutdown...
180108 14:26:42  InnoDB: Shutdown completed; log sequence number 233621773
180108 14:26:44 [Note] /usr/libexec/mysqld: Shutdown complete

You see the last activity was on 29.03.2017, in between everything ran smooth, and today InnoDB and MySQL have been shutdown normally. But there are no signs of an attempted start.

When I type in “systemctl start mariadb” it yields an error which I analyzed via “systemctl status mariadb“:

Process: 3738 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
Process: 3737 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=1/FAILURE)

I’m very confused as to what happened and hope you can shed some light on this problem.

Answer

I found the solution by myself in the end.

Procedure:

tail -f /var/log/messages

gave me a list of the last errors and there was:

Jan 10 18:44:48 v22015093023528042 mariadb-prepare-db-dir: The log file /var/log/mariadb/mariadb.log cannot be written, please, fix its permissions.

Then I did:

chown mysql:mysql /var/log/mariadb/mariadb.log

After that I did:

service mariadb start

which worked smoothly and now service mariadb status shows:

mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since Mi 2018-01-10 18:51:54 UTC; 5min ago

God knows what the hosting company changed on my system but now I’m happy 🙂

Attribution
Source : Link , Question Author : Karl , Answer Author : Karl

Leave a Comment