-1

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.

  • Your logs may shed some more light on the failure. They should be in /var/log/mysql or thereabouts. – Simon Greenwood Jan 8 '18 at 17:40
  • Thanks for your time, unfortunately there's only a mariadb.log, In var/log there's no mysql folder – Karl Jan 8 '18 at 18:03
  • Some distributions have swapped maria for mysql, that is why you only see the mariadb.log file. Try to start it manually, without using a service systemd call, etc. This page may be of use - mariadb.com/kb/en/library/what-to-do-if-mariadb-doesnt-start – ivanivan Jan 8 '18 at 19:53
  • can you log into mariadb from the shell? mysql --user=yourusername --password=yourpassword db_name – user1888089 Jan 8 '18 at 22:41
  • first of all I would take a look if mariadb is running. it look like your database is offline. I dont know how that works on centos but on on a debian machine you would enter /etc/init.d/mysql status or on a redhat machine service mysqld status , if you have installed mysqladmin mysqladmin -u root -p status. Regardless with method you use one of them would output a human readable error code. – user1888089 Jan 8 '18 at 22:52
0

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 :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.