I installed my Yunohost for some times now. It worked fine 'till recently when i found that my owncloud was down and my cron was mailing me some error about the MySQL DB not reachable.
Here is the error mailed by cron:
/etc/cron.daily/logrotate:
logrotate_script: 1: logrotate_script: my_print_defaults: not found
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
error: error running shared postrotate script for '/var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log /var/log/mysql/error.log '
run-parts: /etc/cron.daily/logrotate exited with return code 1
I checked and the MySQL server was down. I first tryed to update the system before attempting to relaunch mysql and there an other error came up: APT install the package mariadb-server-10.0.
After that, i messed up with APT and probably made a mistake. Anyhow, now yunohost andyunohost-admin are not installed anymore.
My server is still up (emails are still coming in and going out, I can access yunohost SSO page, but I am afraid that a reboot may stop everything and that I would be forced to reinstall my Yunohost…
Is there a way to recover from the state I am in ?
well you aint the first one to have issues with mysql/mariadb, I’m hearing a lot about it these days :D. But to be able to help you, we gonna need some more details to pinpoint the exact issue. Do you have any error messages regarding what happened with mariadb and apt ? What do you get if you check the status of mysql (e.g. with service mysql status (or mysqld ?)) ?
Might be the same issue I encounter on my test servers : if you’re running on ‘slow’ hardware (Raspberry ? Internet cube ?), mariadb might be slow to start and timeouts…
Can you check the end of the logs of mysql, which should be /var/lib/mysql/yourdomain.err or something like this … ?
Visiblement, le log dans /var/lib/mysql montre qu’il s’agit d’un probleme de table corrompue (oep, c’est un espèce de problème récurrent avec mysql, des fois il s’auto-corromp sans qu’on sache vraiment pourquoi ?).
Le truc c’est que je peux même pas lancer de serveur mysql puisque le paquet refuse de s’installer…
Du coup, je n’ai pas de serveur SQL qui tourne et donc mon client mysql me jette:
-> # mysql
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2 “No such file or directory”)
J’ai essayé de réinstaller un serveur mysql 5.5, sans succès (sortie d’APT ici)
Je repense aux histoires de timeout dont tu parlais plus haut.
J’ai lancé plusieurs fois la commande service mysql start et elle met un certains temps (~30s) avant de sortir sur erreur. Une piste à creuser ?
EDIT : Nouveaux développements.
Le soucis venait en effet des tables. Ne pouvant pas lancer de serveur, j’ai fait un backup de /var/lib/mysql puis relancer une install de mariadb-server-10.0. Ca a fonctionner ! Je fait deux trois tests pour remettre les tables que j’avais en place et je reviens pour clore le topic. MERCI !
I reply in english in case someone not ‘francophone’ is interested in the response.
I finally successfully got a mysql server working again. Problem is, the new installation can’t retake my old databases as-is and I still have not found how to make it work yet.
What I actually did was to backup the mysql directory where the databases are stored (by default /var/lib/mysql) using the following command:
# mv /var/lib/mysql /var/lib/mysql.back
Of course, you can use any directory name as long as it is different than the source one.
Then, I had to re-install the package mariadb-server-10.0.
# apt-get install mariadb-server-10.0 mariadb-server
And voila !
Your old databases are stored where you put your backup in case you find some solution about reintegrate them in the new, fresh install.