Mysql permission denied and failed to start after 3.7 upgrade

Bonjour à tous,

J’utilise Yunohost en production depuis la version 2.4.
Les mises à jour, migrations se sont toujours passées impeccablement.
Je n’ai pas de modification particulière de mon instance.
Ca tourne sur un Rpi 3 b+.

La dernière mise à jour système s’est passé sans problème.
Puis, lancement de la mise à jour de Nextcloud, et là: arrêt, le service mysql est arrêté.
Ce que j’ai tenté, sans succès de:

  • Démarrer le service via web admin
  • Redémarrer le serveur
  • Suivre ces topics:

Quand j’essai:
mysqld_safe --skip-grant-tables
J’obtiens ceci:

/usr/bin/mysqld_safe_helper: Can’t create/write to file ‘/var/lib/mysql/YunoHost.err’ (Errcode: 13 “Permission denied”)

Puis:
mysqlcheck -c -u root --all-databases
J’obtiens ceci:

mysqlcheck: Got error: 2002: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2 “No such file or directory”) when trying to connect

Puis:
mysqldump myDB > myDB.sql
J’obtiens ceci:

mysqldump: Got error: 2002: “Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2 “No such file or directory”)” when trying to connect

Je ne suis pas allé plus loin dans ce topic.

J’ai suivi aussi ce topic:

Retours similaires

Puis ces topics pour essayer mysql auto-fix:

Voici les résultats:
(ve) admin@YunoHost:~/git/auto-fix-mysql $ python auto-fix-mysql backup-mysql-db
Me renvoi:

Traceback (most recent call last):
File “auto-fix-mysql”, line 502, in
parser.dispatch()
File “/home/admin/git/auto-fix-mysql/ve/local/lib/python2.7/site-packages/argh/helpers.py”, line 55, in dispatch
return dispatch(self, *args, **kwargs)
File “/home/admin/git/auto-fix-mysql/ve/local/lib/python2.7/site-packages/argh/dispatching.py”, line 174, in dispatch
for line in lines:
File “/home/admin/git/auto-fix-mysql/ve/local/lib/python2.7/site-packages/argh/dispatching.py”, line 277, in _execute_command
for line in result:
File “/home/admin/git/auto-fix-mysql/ve/local/lib/python2.7/site-packages/argh/dispatching.py”, line 260, in _call
result = function(*positional, **keywords)
File “auto-fix-mysql”, line 133, in backup_mysql_db
password=open(“/etc/yunohost/mysql”, “r”).read().strip(),
IOError: [Errno 13] Permission denied: ‘/etc/yunohost/mysql’

Et
(ve) admin@YunoHost:~/git/auto-fix-mysql $ rsync -av /etc/yunohost/auto-fix-mysql/mysql-db-backup/ /root/backup-mysql-db-$(date +%Y-%m-%d)
Me renvoi:

sending incremental file list
rsync: change_dir “/etc/yunohost/auto-fix-mysql/mysql-db-backup” failed: No such file or directory (2)
rsync: ERROR: cannot stat destination “/root/backup-mysql-db-2020-03-29”: Permission denied (13)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(653) [Receiver=3.1.2]

VOILA!!
Besoin d’aide ici pour continuer.
Merci à tous!
PS: je trouve que les nouvelles fonctionnalités de la version 3.7 sont super!

Zain

Some commands need to be run as root or with sudo, that’s why you have “Permission denied”.

What about:

sudo systemctl restart mysql
sudo systemctl status mysql

Hi @ljf,

sudo systemctl restart mysql

Send back:

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

And

sudo systemctl status mysql

Send back:

● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql; generated; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2020-03-29 13:29:15 UTC; 1min 49s ago
Docs: man:systemd-sysv-generator(8)
Process: 29171 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

Mar 29 13:28:43 YunoHost systemd[1]: Starting LSB: Start and stop the mysql database server daemon…
Mar 29 13:29:15 YunoHost mysql[29171]: Starting MariaDB database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed!
Mar 29 13:29:15 YunoHost systemd[1]: mysql.service: Control process exited, code=exited status=1
Mar 29 13:29:15 YunoHost systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
Mar 29 13:29:15 YunoHost systemd[1]: mysql.service: Unit entered failed state.
Mar 29 13:29:15 YunoHost systemd[1]: mysql.service: Failed with result ‘exit-code’.

Thank for the help.

And
sudo journalctl -xe

Sends back:

Mar 29 13:29:15 YunoHost /etc/init.d/mysql[29634]: 0 processes alive and ‘/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping’ resulted in
Mar 29 13:29:15 YunoHost /etc/init.d/mysql[29634]: [61B blob data]
Mar 29 13:29:15 YunoHost /etc/init.d/mysql[29634]: error: ‘Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2 “No such file or directory”)’
Mar 29 13:29:15 YunoHost /etc/init.d/mysql[29634]: Check that mysqld is running and that the socket: ‘/var/run/mysqld/mysqld.sock’ exists!
Mar 29 13:29:15 YunoHost /etc/init.d/mysql[29634]:
Mar 29 13:29:15 YunoHost mysql[29171]: Starting MariaDB database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed!
Mar 29 13:29:15 YunoHost sudo[29163]: pam_unix(sudo:session): session closed for user root
Mar 29 13:29:15 YunoHost systemd[1]: mysql.service: Control process exited, code=exited status=1
Mar 29 13:29:15 YunoHost systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
– Subject: Unit mysql.service has failed
– Defined-By: systemd
– Support: Debian -- User Support

– Unit mysql.service has failed.

– The result is failed.
Mar 29 13:29:15 YunoHost systemd[1]: mysql.service: Unit entered failed state.
Mar 29 13:29:15 YunoHost systemd[1]: mysql.service: Failed with result ‘exit-code’.
Mar 29 13:30:01 YunoHost CRON[29642]: pam_unix(cron:session): session opened for user root by (uid=0)
Mar 29 13:30:01 YunoHost CRON[29643]: pam_unix(cron:session): session opened for user nextcloud by (uid=0)
Mar 29 13:30:01 YunoHost CRON[29652]: (root) CMD (yunohost dyndns update >> /dev/null)
Mar 29 13:30:01 YunoHost CRON[29654]: (nextcloud) CMD (/usr/bin/php -f /var/www/nextcloud/cron.php)
Mar 29 13:30:01 YunoHost CRON[29643]: pam_unix(cron:session): session closed for user nextcloud
Mar 29 13:30:01 YunoHost postfix/pickup[28120]: CC74D381E: uid=999 from=
Mar 29 13:30:01 YunoHost postfix/cleanup[29662]: CC74D381E: message-id=20200329133001.CC74D381E@mydomain.noho.st
Mar 29 13:30:01 YunoHost postfix/qmgr[1919]: CC74D381E: from=nextcloud@mydomain.noho.st, size=2862, nrcpt=1 (queue active)
Mar 29 13:30:02 YunoHost postfix/pipe[29669]: CC74D381E: to=nextcloud@mydomain.noho.st, orig_to=, relay=dovecot, delay=0.34, delays=0.11/0.02/0/0.21, dsn=5.1.1, status=bounced (user unknown)
Mar 29 13:30:02 YunoHost postsrsd[29667]: srs_forward: <“”> not rewritten: No at sign in sender address
Mar 29 13:30:02 YunoHost postfix/cleanup[29662]: 1E4423D61: message-id=20200329133002.1E4423D61@mydomain.noho.st
Mar 29 13:30:02 YunoHost postfix/bounce[29678]: CC74D381E: sender non-delivery notification: 1E4423D61
Mar 29 13:30:02 YunoHost postfix/qmgr[1919]: 1E4423D61: from=<>, size=4881, nrcpt=1 (queue active)
Mar 29 13:30:02 YunoHost postfix/qmgr[1919]: CC74D381E: removed
Mar 29 13:30:05 YunoHost CRON[29642]: pam_unix(cron:session): session closed for user root
Mar 29 13:30:07 YunoHost postfix/pipe[29669]: 1E4423D61: to=nextcloud@mydomain.noho.st, relay=dovecot, delay=5.1, delays=0.01/5/0/0.08, dsn=5.1.1, status=bounced (user unknown)
Mar 29 13:30:07 YunoHost postfix/qmgr[1919]: 1E4423D61: removed
Mar 29 13:31:00 YunoHost sshd[29697]: Connection from 103.27.239.185 port 54016 on 192.168.0.74 port 22
Mar 29 13:31:03 YunoHost sshd[29697]: Did not receive identification string from 103.27.239.185 port 54016
Mar 29 13:31:04 YunoHost slapd[1507]: slap_global_control: unrecognized control: 1.3.6.1.4.1.4203.666.5.16
Mar 29 13:31:04 YunoHost sudo[29698]: admin : TTY=pts/0 ; PWD=/home/admin ; USER=root ; COMMAND=/bin/systemctl status mysql
Mar 29 13:31:04 YunoHost sudo[29698]: pam_unix(sudo:session): session opened for user root by admin(uid=0)
Mar 29 13:31:05 YunoHost sudo[29698]: pam_unix(sudo:session): session closed for user root
Mar 29 13:32:01 YunoHost CRON[29710]: pam_unix(cron:session): session opened for user root by (uid=0)
Mar 29 13:32:01 YunoHost CRON[29714]: (root) CMD (yunohost dyndns update >> /dev/null)
Mar 29 13:32:06 YunoHost CRON[29710]: pam_unix(cron:session): session closed for user root
Mar 29 13:34:01 YunoHost CRON[29740]: pam_unix(cron:session): session opened for user root by (uid=0)
Mar 29 13:34:01 YunoHost CRON[29744]: (root) CMD (yunohost dyndns update >> /dev/null)
Mar 29 13:34:05 YunoHost CRON[29740]: pam_unix(cron:session): session closed for user root
Mar 29 13:34:46 YunoHost sshd[29762]: Connection from 95.217.11.41 port 55602 on 192.168.0.74 port 22
Mar 29 13:34:46 YunoHost sshd[29762]: Received disconnect from 95.217.11.41 port 55602:11: Bye Bye [preauth]
Mar 29 13:34:46 YunoHost sshd[29762]: Disconnected from 95.217.11.41 port 55602 [preauth]
Mar 29 13:35:01 YunoHost CRON[29764]: pam_unix(cron:session): session opened for user root by (uid=0)
Mar 29 13:35:01 YunoHost CRON[29768]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Mar 29 13:35:01 YunoHost CRON[29764]: pam_unix(cron:session): session closed for user root
Mar 29 13:35:34 YunoHost slapd[1507]: slap_global_control: unrecognized control: 1.3.6.1.4.1.4203.666.5.16
Mar 29 13:35:34 YunoHost sudo[29777]: admin : TTY=pts/0 ; PWD=/home/admin ; USER=root ; COMMAND=/bin/systemctl status mysql.service
Mar 29 13:35:34 YunoHost sudo[29777]: pam_unix(sudo:session): session opened for user root by admin(uid=0)
Mar 29 13:35:34 YunoHost sudo[29777]: pam_unix(sudo:session): session closed for user root
Mar 29 13:36:01 YunoHost CRON[29789]: pam_unix(cron:session): session opened for user root by (uid=0)
Mar 29 13:36:01 YunoHost CRON[29793]: (root) CMD (yunohost dyndns update >> /dev/null)
Mar 29 13:36:05 YunoHost CRON[29789]: pam_unix(cron:session): session closed for user root
Mar 29 13:36:25 YunoHost sudo[29812]: admin : TTY=pts/0 ; PWD=/home/admin ; USER=root ; COMMAND=/bin/journalctl -xe
Mar 29 13:36:25 YunoHost sudo[29812]: pam_unix(sudo:session): session opened for user root by admin(uid=0)
lines 1260-1321/1321 (END)

ljf faisais references en particulier à ces commandes je pense, qu’il faut faire avec “sudo” :wink:

(Tu peux aussi passer root en faisant sudo su pour ne pas avoir à taper sudo à chaque fois)

Ah bah oui c’est mieux!
Alors voici ce que ça renvoi:>

root@YunoHost:/home/admin# mysqld_safe --skip-grant-tables
200329 13:57:00 mysqld_safe Logging to ‘/var/lib/mysql/YunoHost.err’.
200329 13:57:00 mysqld_safe Starting mysqld daemon with databases from /var/lib/ mysql

root@YunoHost:/home/admin# mysqlcheck -c -u root --all-databases
mysqlcheck: Got error: 2002: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2 “No such file or directory”) when trying to connect

Et là:

(ve) root@YunoHost:/home/admin/git/auto-fix-mysql# python auto-fix-mysql backup-mysql-db
Traceback (most recent call last):
File “auto-fix-mysql”, line 502, in
parser.dispatch()
File “/home/admin/git/auto-fix-mysql/ve/local/lib/python2.7/site-packages/argh/helpers.py”, line 55, in dispatch
return dispatch(self, *args, **kwargs)
File “/home/admin/git/auto-fix-mysql/ve/local/lib/python2.7/site-packages/argh/dispatching.py”, line 174, in dispatch
for line in lines:
File “/home/admin/git/auto-fix-mysql/ve/local/lib/python2.7/site-packages/argh/dispatching.py”, line 277, in _execute_command
for line in result:
File “/home/admin/git/auto-fix-mysql/ve/local/lib/python2.7/site-packages/argh/dispatching.py”, line 260, in _call
result = function(*positional, **keywords)
File “auto-fix-mysql”, line 135, in backup_mysql_db
database=‘mysql’
File “/home/admin/git/auto-fix-mysql/ve/local/lib/python2.7/site-packages/mysql/connector/init.py”, line 179, in connect
return MySQLConnection(*args, **kwargs)
File “/home/admin/git/auto-fix-mysql/ve/local/lib/python2.7/site-packages/mysql/connector/connection.py”, line 95, in init
self.connect(**kwargs)
File “/home/admin/git/auto-fix-mysql/ve/local/lib/python2.7/site-packages/mysql/connector/abstracts.py”, line 716, in connect
self._open_connection()
File “/home/admin/git/auto-fix-mysql/ve/local/lib/python2.7/site-packages/mysql/connector/connection.py”, line 206, in _open_connection
self._socket.open_connection()
File “/home/admin/git/auto-fix-mysql/ve/local/lib/python2.7/site-packages/mysql/connector/network.py”, line 512, in open_connection
errno=2003, values=(self.get_address(), _strioerror(err)))
mysql.connector.errors.InterfaceError: 2003: Can’t connect to MySQL server on ‘127.0.0.1:3306’ (111 Connection refused)

Et voici ce que la webadmin me dit:

image

Est-ce que tu as de la place sur ton serveur ?

df -h

Oui.

Filesystem Size Used Avail Use% Mounted on
/dev/root 229G 146G 74G 67% /
devtmpfs 459M 0 459M 0% /dev
tmpfs 464M 84K 463M 1% /dev/shm
tmpfs 464M 18M 446M 4% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 464M 0 464M 0% /sys/fs/cgroup
/dev/mmcblk0p1 63M 23M 40M 36% /boot
tmpfs 93M 0 93M 0% /run/user/1007

Et le swap est de 1 go

Des idées pour m’aider à réparer?
J’ai bien tenté l’auto-fix mais j’ai un message d’erreur: 111 connection refused

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.