NCbox 11.0.3 - Can't connect Mysql

Hi everybody

Nextcloud version : 11.0.3
Operating system and version : Ubuntu Core + Snap nextcloud 11.0.3 on raspbery pi 3
First time I saw this error.


Nextcloud was fonctionnal before, it’s not installation problem.
I think problem is due to a big file sync, no setting change by me… and probably because of low memory on RB3.

I follow many posts to test resolve this problem, so I let here things who could help you.
Nextcloud didn’t work due to MySQL access.


Error :

sudo nextcloud.mysql-client
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/sockets/mysql.sock'

Restart service
Same after : sudo systemctl restart snap.nextcloud.mysql.service
Also after system reboot.


Log
sudo journalctl -u snap.nextcloud.mysql.service

May 06 12:43:14 localhost.localdomain systemd[1]: Stopping Service for snap application nextcloud.mysql...
May 06 12:43:14 localhost.localdomain snap[3924]:  * MySQL server PID file could not be found!
May 06 12:43:14 localhost.localdomain snap[3042]: Waiting for MySQL...
May 06 12:43:14 localhost.localdomain systemd[1]: Stopped Service for snap application nextcloud.mysql.
May 06 12:43:14 localhost.localdomain systemd[1]: Started Service for snap application nextcloud.mysql.
May 06 12:43:14 localhost.localdomain snap[3948]: 2017-05-06T12:43:14.674064Z 0 [Warning] Changed limits: max_open_files: 1024 (r
May 06 12:43:14 localhost.localdomain snap[3948]: 2017-05-06T12:43:14.674602Z 0 [Warning] Changed limits: table_open_cache: 431 (
May 06 12:43:14 localhost.localdomain snap[3948]: 2017-05-06T12:43:14.675705Z 0 [Warning] TIMESTAMP with implicit DEFAULT value i
May 06 12:43:14 localhost.localdomain snap[3948]: 2017-05-06T12:43:14.683874Z 0 [ERROR] --initialize specified but the data direc
May 06 12:43:14 localhost.localdomain snap[3948]: 2017-05-06T12:43:14.684104Z 0 [ERROR] Aborting
May 06 12:43:14 localhost.localdomain snap[3948]: Starting MySQL
May 06 12:43:17 localhost.localdomain snap[3948]: ... * The server quit without updating PID file (/tmp/pids/mysql.pid).

Test to kill Mysql

ps -ef | grep mysql
root     32677     1  0 12:29 ?        00:00:00 /bin/sh /snap/nextcloud/1288/bin/start_mysql

sudo kill -9 PID

May 07 12:29:00 localhost.localdomain systemd[1]: snap.nextcloud.mysql.service: Main process exited, code=killed, status=9/KILL
May 07 12:29:00 localhost.localdomain snap[3948]: Waiting for MySQL...
May 07 12:29:00 localhost.localdomain snap[32653]:  * MySQL server PID file could not be found!
May 07 12:29:00 localhost.localdomain systemd[1]: snap.nextcloud.mysql.service: Unit entered failed state.
May 07 12:29:00 localhost.localdomain systemd[1]: snap.nextcloud.mysql.service: Failed with result 'signal'.
May 07 12:29:00 localhost.localdomain systemd[1]: snap.nextcloud.mysql.service: Service hold-off time over, scheduling restart.
May 07 12:29:00 localhost.localdomain systemd[1]: Stopped Service for snap application nextcloud.mysql.
May 07 12:29:00 localhost.localdomain systemd[1]: Started Service for snap application nextcloud.mysql.
May 07 12:29:00 localhost.localdomain snap[32677]: 2017-05-07T12:29:00.950891Z 0 [Warning] Changed limits: max_open_files: 1024 (
May 07 12:29:00 localhost.localdomain snap[32677]: 2017-05-07T12:29:00.951407Z 0 [Warning] Changed limits: table_open_cache: 431 
May 07 12:29:00 localhost.localdomain snap[32677]: 2017-05-07T12:29:00.952735Z 0 [Warning] TIMESTAMP with implicit DEFAULT value 
May 07 12:29:00 localhost.localdomain snap[32677]: 2017-05-07T12:29:00.960543Z 0 [ERROR] --initialize specified but the data dire
May 07 12:29:00 localhost.localdomain snap[32677]: 2017-05-07T12:29:00.960724Z 0 [ERROR] Aborting
May 07 12:29:01 localhost.localdomain snap[32677]: Starting MySQL
May 07 12:29:04 localhost.localdomain snap[32677]: ... * The server quit without updating PID file (/tmp/pids/mysql.pid).

root.ini
sudo vi /var/snap/nextcloud/current/mysql/root.ini

[client]
socket=/tmp/sockets/mysql.sock
user=root
password= ****

Directory
cd /snap/nextcloud/

drwxr-xr-x  5 root root 4096 Apr 30 11:41 ./
drwxr-xr-x  8 root root 4096 May  5 19:24 ../
drwxr-xr-x 24 root root  930 Mar 10 23:55 1190/
drwxr-xr-x 24 root root  930 Apr 25 18:02 1215/
drwxr-xr-x 24 root root  930 Apr 30 08:28 1288/
lrwxrwxrwx  1 root root    4 Apr 30 11:41 current -> 1288/

Have you any idea to help me ?
Thanks !!!
Éric

Note that there is no “sockets” directory in /tmp
This is the content of /tmp

drwxrwxrwt 9 root root 180 May 8 07:48 ./
drwxr-xr-x 23 root root 320 Apr 11 12:29 …/
drwxrwxrwt 2 root root 40 Apr 20 15:09 .ICE-unix/
drwxrwxrwt 2 root root 40 Apr 20 15:09 .Test-unix/
drwxrwxrwt 2 root root 40 Apr 20 15:09 .X11-unix/
drwxrwxrwt 2 root root 40 Apr 20 15:09 .XIM-unix/
drwxrwxrwt 2 root root 40 Apr 20 15:09 .font-unix/
drwx------ 3 root root 60 Apr 20 15:09 snap.0_nextcloud_sRlrVN/
drwx------ 3 root root 60 Apr 20 15:09 systemd-private-484413e

the socketfile should be in snap.0_nextcloud_sRlrVN/tmp/sockets/ (you need to be root to look into it.)

thats a instanced tmp folder inside snap for isolating applications.

ps aux | grep mysql should show sort of that:

root     20800  0.0  0.0   1464   836 ?        S    Apr30   0:00 /bin/sh /snap/nextcloud/1288/bin/mysqld_safe --datadir=/var/snap/nextcloud/1288/mysql --pid-file=/tmp/pids/mysql.pid --lc-messages-dir=/snap/nextcloud/1288/share --socket=/tmp/sockets/mysql.sock
root     21003  0.2 12.5 1218220 118124 ?      Sl   Apr30  30:50 /snap/nextcloud/1288/bin/mysqld --basedir=/snap/nextcloud/1288 --datadir=/var/snap/nextcloud/1288/mysql --plugin-dir=/snap/nextcloud/1288/lib/plugin --lc-messages-dir=/snap/nextcloud/1288/share --log-error=/var/snap/nextcloud/1288/mysql/ubuntu-standard.err --pid-file=/tmp/pids/mysql.pid --socket=/tmp/sockets/mysql.sock

if not, mysql is not running.

Thanks for your answer, but I don’t know how to be root on ubuntu core…

My ps aux | grep mysql show only that:

root 13123 0.0 0.1 1464 1016 ? Ss 07:43 0:14 /bin/sh /snap/nextcloud/1288/bin/start_mysql

I think Mysql isn’t launched, and can’t launch… but I don’t understand why…

For info, I cross post my question as a snap issue here.

Éric

OK, just sudo su… !

In my /tmp/snap.0_nextcloud_sRlrVN/tmp/sockets I got only:

drwxr-x--- 2 root root  60 May  8 07:43 ./
drwxrwxrwt 4 root root 120 May  8 07:43 ../
srwxr-xr-x 1 root root   0 May  8 07:43 redis.sock=

No mysql.sock

Hello,
It’s ok now… perhaps not enough memory on sd card : I remove a dump file…
Not really sure…
Éric

Hi Éric

How did you remove the dump file and where was it?
I think I have a similar problem