MySQL not running and cannot log in to PHPMyAdmin. Not caused by not enough disk space

Keywords: WordPress - AWS - Technical issue - Other
bnsupport ID: 45b810bf-938d-2f67-6389-a367bb6dcacc
Description:
I have an EC2 instance with a bitnami WordPress image.

MySQL is not running and the log file is empty. I tried several things to examine the problem but had no luck.

Here are the results:

bitnami@ip-172-31-41-125:~$ du -ch --max-depth=1 /opt/bitnami/
52K     /opt/bitnami/config
48K     /opt/bitnami/bndiagnostic
32M     /opt/bitnami/letsencrypt
116K    /opt/bitnami/scripts
238M    /opt/bitnami/apache2
3.0M    /opt/bitnami/stats
79M     /opt/bitnami/bncert
91M     /opt/bitnami/bnsupport
du: cannot read directory '/opt/bitnami/apps/phpmyadmin/htdocs/tmp/twig': Permission denied
460M    /opt/bitnami/apps
4.2M    /opt/bitnami/bnhelper
3.6M    /opt/bitnami/varnish
3.5M    /opt/bitnami/sqlite
80M     /opt/bitnami/php
du: cannot read directory '/opt/bitnami/mysql/data': Permission denied
345M    /opt/bitnami/mysql
1.6M    /opt/bitnami/licenses
8.0K    /opt/bitnami/img
du: cannot read directory '/opt/bitnami/var/data': Permission denied
84K     /opt/bitnami/var
145M    /opt/bitnami/common
1.5G    /opt/bitnami/
1.5G    total
bitnami@ip-172-31-41-125:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            1.9G     0  1.9G   0% /dev
tmpfs           391M   21M  371M   6% /run
/dev/nvme0n1p1   15G  5.9G  8.6G  41% /
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/loop1       99M   99M     0 100% /snap/core/11081
/dev/loop0       56M   56M     0 100% /snap/core18/1997
/dev/loop3       33M   33M     0 100% /snap/amazon-ssm-agent/2996
/dev/loop2       56M   56M     0 100% /snap/core18/2066
/dev/loop4       34M   34M     0 100% /snap/amazon-ssm-agent/3552
/dev/loop5      100M  100M     0 100% /snap/core/11167
tmpfs           391M     0  391M   0% /run/user/1000

bitnami@ip-172-31-41-125:~$ du -ch --max-depth=1 / 2>/dev/null
4.0K    /lib64
79M     /boot
4.0K    /srv
21M     /run
3.1G    /usr
0       /dev
0       /proc
60K     /home
14M     /sbin
0       /sys
239M    /lib
5.7M    /etc
4.0K    /root
22M     /tmp
16M     /bin
16K     /lost+found
4.0K    /media
1.5G    /opt
782M    /var
1.3G    /snap
4.0K    /mnt
6.9G    /
6.9G    total

I cannot log into MyPHPAdmin because I get this error:

mysqli::real_connect(): (HY000/2002): No such file or directory

I tried to run this command

    sudo chown mysql:root -R /opt/bitnami/mysql/data

but still could not start MySQL with

    sudo /opt/bitnami/ctlscript.sh restart mysql

I ran 2 times /opt/bitnami/bnsupport-tool and the tool said that MySQL was okay but Apache had some errors.

===== Begin of bndiagnostic tool output =====

? Apache: Found possible issues
✓ Resources: No issues found
✓ Mysql: No issues found
✓ Connectivity: No issues found
✓ Php: No issues found

[Apache]

Found recent errors and warning messages in the Apache error log:
[Tue Jun 08 01:17:14.952500 2021] [authz_core:error] [pid 26456:tid
139921788471040] [client 52.231.13.90:50402] AH01630: client denied by server
configuration: /opt/bitnami/apps/phpmyadmin/htdocs/
 [Tue Jun 08 12:27:51.726044 2021] [authz_core:error] [pid 26896:tid
139921746507520] [client 52.231.13.90:36954] AH01630: client denied by server
configuration: /opt/bitnami/apps/phpmyadmin/htdocs/
 [Tue Jun 08 20:34:14.015945 2021] [authz_core:error] [pid 26788:tid
139921461155584] [client 54.91.254.231:50100] AH01630: client denied by server
configuration: /opt/bitnami/apps/phpmyadmin/htdocs/

The second one was:

Found recent Pagespeed related error messages in the Apache error log:

[Wed Jun 09 06:18:04.711143 2021] [pagespeed:error] [pid 32709:tid
139921284908800] [mod_pagespeed 1.13.35.2-0 @32709] PageSpeed Serf fetch failure
rate extremely high; only 0 of 15 recent fetches fully successful; is fetching
working?

I disabled PageSpeed following these steps:

Comment out the following lines in the /opt/bitnami/apache2/conf/httpd.conf file:

    #Include conf/pagespeed.conf
    #Include conf/pagespeed_libraries.conf

Restarted Apache and still nothing.

This is the ID I received after the audit finished:
45b810bf-938d-2f67-6389-a367bb6dcacc

Can someone help me resolve this issue?

Hi @plamenm.metodiev,

Thanks for using Bitnami. Can you try the next MySQL permissions?

sudo chown -R mysql:mysql /opt/bitnami/mysql/data

After that, can you try to start MySQL again?

sudo /opt/bitnami/ctlscript.sh start mysql

Thanks, for the quick reply. Tried the commands and still:
/opt/bitnami/mysql/scripts/ctl.sh : mysql could not be started
Monitored mysql

Hi @plamenm.metodiev,

Can you manually run the next command that will manually start MySQL and share the output with us?

/opt/bitnami/mysql/bin/mysqld_safe --defaults-file=/opt/bitnami/mysql/my.cnf --mysqld=mysqld.bin --socket=/opt/bitnami/mysql/tmp/mysql.sock --old-passwords --datadir=/opt/bitnami/mysql/data --pid-file=/opt/bitnami/mysql/data/mysqld.pid --lower-case-table-names=1 --default-table-type=InnoDB --console

Hello @gongomgra,

Here is the output:

-bash: /opt/bitnami/bin/mysqld_safe: No such file or directory

Looks like the instance does not have a needed directory to work properly?

Hi @plamenm.metodiev,

I introduced a typo in my previous reply. Can you check the updated command?

Hi @gongomgra,

Thanks for the quick fix! Here is the output:

2021-06-10T10:38:15.316411Z mysqld_safe Logging to '/opt/bitnami/mysql/data/ip-172-31-41-125.err'.
2021-06-10T10:38:15.320194Z mysqld_safe Directory '/opt/bitnami/mysql/tmp' for UNIX socket file don't exists.

Hi @plamenm.metodiev,

Thanks for the info. According to the bnsupport bundle you shared, this folder doesn’t exist on your instance. Did you remove it by mistake? Can you run the next commands to regenerate it?

sudo mkdir -p /opt/bitnami/mysql/tmp
sudo chmod 777 /opt/bitnami/mysql/tmp

After that, try to restart MySQL using the ctlscript.sh tool, if it fails, please run the manual command again and share with us the new output.

1 Like

Hi @gongomgra,

This fixed the issue and I was able to start MySQL. I do not remember deleting this folder, strange.

Thank you very much, I really appreciate your support!

Best regards!

Hi @plamenm.metodiev,

Thanks for the info. I’m glad you fixed your issue! We will close this thread as solved. Please do not hesitate to open a new one with any other questions you may have.