1

I have recently bought a new laptop running Ubuntu 16.04.1 LTS (64 bit). I have installed dozens of applications, but one is giving me a major headache and any help would be gratefully received.

I start from a clean slate with regard to mysql:

sudo apt remove --purge mysql-server mysql-client mysql-common
sudo apt autoremove
sudo rm -rf /var/lib/mysql*
sudo apt install mysql-server

I install my database from backup and everything works fine.

I power-off/power-on the laptop and mysql isn't working. Firstly the daemon is not running:

ps -A | grep sql
2056 ? 00:00:00 mysql-systemd-s

but something I don't recognise called mysql-systemd-s is running.

It is now impossible to use mysql:

mysql -u root -p
Enter password:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial 
communication packet', system error: 104

The service seems to be unstartable:

service mysql start
Job for mysql.service failed because the control process exited with 
error code. See "systemctl status mysql.service" and "journalctl -xe"  
for details.

but neither of these is useful. The /var/log/mysql/error.log has a little more information:


......
2017-01-13T21:01:04.926244Z 0 [Warning] Failed to set up SSL because 
of the following SSL library error: SSL context is not usable without 
certificate and private key
2017-01-13T21:01:04.926272Z 0 [Note] Server hostname (bind-address): 
'127.0.0.1'; port: 3306
2017-01-13T21:01:04.926288Z 0 [Note] - '127.0.0.1' resolves to 
'127.0.0.1';
2017-01-13T21:01:04.926327Z 0 [Note] Server socket created on IP: 
'127.0.0.1'.
2017-01-13T21:01:04.927774Z 0 [ERROR] Fatal error: mysql.user table is damaged. Please run mysql_upgrade.
2017-01-13T21:01:04.927897Z 0 [ERROR] Aborting

However, the recommendation to run mysql_upgrade is useless because one can't run mysql_upgrade unless the mysql server is running! And the mysql server isn't running because of this error.

So, I remove and re-install everything and run mysql_upgrade. This seems to complete without error. But, again when I power cycle the machine, I'm back without mysql working.

I have also tried starting the mysqld with the --skip-grant-tables options, but this still does not allow connexion.

At the moment, every time I reboot my computer I have to remove all traces of mysql, re-install mysql and then reload my database from a backup. This is a real pain.

Does anyone have any ideas about what's happening?

Chris Hobbs
  • 345
  • 2
  • 7
  • http://stackoverflow.com/questions/5755819/lost-connection-to-mysql-server-at-reading-initial-communication-packet-syste – Mees Kluivers Jan 13 '17 at 22:00
  • The problem still exists (and I am still tearing my hair out). However, I have discovered the following: mysql survives a power-off/power-on if I don't load my database from backup. If I do load my database from backup then everything works well until I power-off/power-on and then the problem described above occurs. – Chris Hobbs Jan 16 '17 at 22:24
  • This would imply that there is something wrong with the backup that I'm restoring. The backup was from mysqldump just before I switched to the new machine and begins: -- MySQL dump 10.13 Distrib 5.7.16, for Linux (x86_64) -- -- Host: localhost Database: -- ------------------------------------------------------ -- Server version 5.7.16-0ubuntu0.16.04.1 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; – Chris Hobbs Jan 16 '17 at 22:28

1 Answers1

0

Problem appears to be resolved. The clue was that mysqld seemed to survive a power-off/power-on if I didn't restore my own database backup. It didn't if I did restore that backup.

Generally, I never look at my database backups; rather I just do a mysqldump and keep the resulting file in case of a rainy day.

Given the clues above, I took a look at the file that had been produced by mysqldump and reduced it to its minimum size so that it just contained the database that I wanted to restore. That appears to have done the trick.

I have kept the bad file and have been playing with diffs to find what was nasty in it, but haven't yet found it.

Chris Hobbs
  • 345
  • 2
  • 7