Ok, first, sorry for this question, I usually search a lot before post a question on any forum or Q&A. But now I'm on panic, I need help (also to keep my job). :)

This morning the server I manage who host many websites of clients of the company where I work had a problem. The error when I try to visit one of the website is simply:

Error establishing a database connection

First I've tried to login into plesk, but the error was the same (failed to connect to the DB) So I tried to restart the entire VPS, but nothing to do the error still there, so I connected through ssh and I tried with:

sudo /etc/init.d/mysql start

I check for the mysql logs and it was empty except for this:

160801 08:07:11 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 160801 8:07:11 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead. 160801 8:07:11 [Note] /usr/sbin/mysqld (mysqld 5.5.46-0ubuntu0.14.04.2) starting as process 5448 ... 160801 8:07:11 [ERROR] COLLATION 'utf8mb4_unicode_ci' is not valid for CHARACTER SET 'utf8' 160801 8:07:11 [ERROR] Aborting

160801 8:07:11 [Note] /usr/sbin/mysqld: Shutdown complete

160801 08:07:11 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

I really don't know what happened but I think the problem could be that error in the log.

  • -1 ServerFault is a Q & A platform and not a forum. Even as the OP you can post an answer and accept it as the solution. Please don't edit your and rename your question to include the answer – HBruijn Aug 1 '16 at 8:03
  • Ok thanks a lot, sorry, this morning I was a little bit in panic (I'm sure you know what I mean). – Gianca Aug 1 '16 at 13:00

I resolved the issue in this way.

I've opened the file /etc/mysql/my.cnf with nano.

sudo nano /etc/mysql/my.cnf

And I've commented this line:

collation-server = utf8mb4_unicode_ci

I tried to start the mysql again and now it works.

I don't know exactly why it happened, and I'm still investigating about.

I hope this could be helpful to someone else.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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