I have a WordPress website hosted by AWS Lightsail.
When I access my website, I got this error - Error establishing a database connection
I didn't change anything for the last few days, and it was working okay.
Also, I have two snapshots and tried to restore the instance, but I got same error messages.
I tried to fix it by adding define('WP_ALLOW_REPAIR', true); line in my wp-config.php file, but it's not working.
I tried to access mysql on the terminal by following the command mysql -u root -p and typed password that I got from cat bitnami_application_password, but I got this error message - ERROR 2002 (HY000): Can't connect to local server through socket '/opt/bitnami/mariadb/tmp /mysql.sock' (111)
$ ps -ef | grep mysql
bitnami 3483 802 0 15:17 pts/0 00:00:00 grep mysql
If I run df -h, I got this:
Filesystem Size Used Avail Use% Mounted on
udev 989M 0 989M 0% /dev
tmpfs 200M 2.9M 197M 2% /run
/dev/xvda1 59G 8.6G 48G 16% /
tmpfs 998M 0 998M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 998M 0 998M 0% /sys/fs/cgroup
/dev/xvda15 124M 278K 124M 1% /boot/efi
tmpfs 200M 0 200M 0% /run/user/1000
If I run sudo service mysql stop, I got this error message:
Failed to stop mysql.service: Unit mysql.service not loaded.
If I run sudo /opt/bitnami/ctlscript.sh status, I got this message:
Cannot find any running daemon to contact. If it is running, make sure you are pointing to the right pid file (/var/run/gonit.pid)
Related
I've tried restarting the services, apache and php-fpm are starting but MySQL won't start.
apache already running
mysql not running```
I ran the df -H command and received the below output.
```Filesystem Size Used Avail Use% Mounted on
udev 2.1G 0 2.1G 0% /dev
tmpfs 410M 5.5M 404M 2% /run
/dev/nvme0n1p1 11G 9.9G 1.2M 100% /
tmpfs 2.1G 0 2.1G 0% /dev/shm
tmpfs 5.3M 0 5.3M 0% /run/lock
tmpfs 2.1G 0 2.1G 0% /sys/fs/cgroup
/dev/nvme0n1p15 130M 285k 130M 1% /boot/efi
tmpfs 410M 0 410M 0% /run/user/1000```
Next I ran the bnsupport tool and received a bunch of errors.
```? Apache: Found possible issues
✓ Connectivity: No issues found
? Resources: Found possible issues
? Mysql: Found possible issues
✓ Php: No issues found```
Found recent Pagespeed related error messages in the Apache error log:
[Tue May 10 07:46:07.202978 2022] [pagespeed:error] [pid 6776:tid
139902133901056] [mod_pagespeed ip_address-0 #6776]
/opt/bitnami/apache2/var/cache/mod_pagespeed/v3/lussolifestyle.com/https,3A/,2Flu
ssolifestyle.com/shop/shoes/slipons/mehroom-tan-zardosi-mojdi/,.tempQG0PxE:
closing file 28
Press [Enter] to continue:Enter
We suggest disabling pagespeed and check if that improves the behavior. Please
check the following guide to disable Pagespeed:
https://docs.bitnami.com/general/apps/wordpress/administration/use-pagespe
ed/#disable-pagespeed
Found recent error or warning messages in the Apache error log.
[Tue May 10 06:41:52.862383 2022] [core:error] [pid 1113:tid 140492772619584]
AH00046: child process 3686 still did not exit, sending a SIGKILL
[Tue May 10 06:41:52.862416 2022] [core:error] [pid 1113:tid 140492772619584]
AH00046: child process 3688 still did not exit, sending a SIGKILL
[Tue May 10 06:41:52.862437 2022] [core:error] [pid 1113:tid 140492772619584]
AH00046: child process 5951 still did not exit, sending a SIGKILL
Please check the following guide to troubleshoot server issues:
https://docs.bitnami.com/general/apps/wordpress/troubleshooting/debug-erro
rs-apache/
A high number of incoming requests originate from one or more unique IP
addresses. This could indicate a bot attack. The following guide shows how to
Press [Enter] to continue:Enter
check for and block suspicious IP addresses.
https://docs.bitnami.com/bch/apps/moodle/troubleshooting/deny-connections-
bots-apache/
[Resources]
Your disk is almost full: You could try to increase your instance's storage.
Filesystem Size Used Avail Use% Mounted on /dev/nvme0n1p1 9.7G 9.3G 0 100% /
Please check your cloud provider's documentation for more information.
[Mysql]
Found recent error messages in the MySQL error log:
2022-05-10T07:41:49.079629Z 0 [ERROR] [MY-010119] [Server] Aborting
Please check the following guide to troubleshoot MySQL issues:
https://docs.bitnami.com/aws/apps/wordpress/troubleshooting/debug-errors-m
Press [Enter] to continue:Enter
ysql/
I am working on a simple application using the LAMP stack using AWS/Lightsail. It worked once, but I rebooted the instance and it stopped working. The data was not available. I suspected issue with MySQL. Below is what I tried. Can anyone suggest any solution for this?
bitnami#ip-123-45-67-89:~$ mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/bitnami/mysql
/tmp/mysql.sock' (2)
bitnami#ip-123-45-67-89:~$ sudo /opt/bitnami/ctlscript.sh status
Cannot find any running daemon to contact. If it is running, make sure you are pointing to
the right pid file (/var/run/gonit.pid)
bitnami#ip-123-45-67-89:~$ ps aux | grep mysql
mysql 607 0.0 6.0 1254660 29812 ? Ssl 04:11 0:11 /usr/sbin/mysqld
bitnami 3338 0.0 0.1 6076 824 pts/0 S+ 14:27 0:00 grep mysql
bitnami#ip-123-45-67-89:~$ sudo /opt/bitnami/ctlscript.sh status
Cannot find any running daemon to contact. If it is running, make sure you are pointing to
the right pid file (/var/run/gonit.pid)
bitnami#ip-123-45-67-89:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 233M 0 233M 0% /dev
tmpfs 49M 2.8M 46M 6% /run
/dev/xvda1 20G 9.5G 9.2G 51% /
tmpfs 242M 0 242M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 242M 0 242M 0% /sys/fs/cgroup
/dev/xvda15 124M 262K 124M 1% /boot/efi
tmpfs 49M 0 49M 0% /run/user/1000
bitnami#ip-123-45-67-89:~$ sudo /opt/bitnami/ctlscript.sh stop mysql
Stopped mysql
bitnami#ip-123-45-67-89:~$ sudo /opt/bitnami/ctlscript.sh start mysql
Failed to start mysql: Failed to start mysql
bitnami#ip-123-45-67-89:~$ ps aux | grep mysql
mysql 607 0.0 3.8 1254660 18912 ? Ssl 04:11 0:11 /usr/sbin/mysqld
bitnami 3560 0.0 0.1 6076 884 pts/0 S+ 14:39 0:00 grep mysql
Several hours ago, I realized that none of our sites work anymore, not even the Plesk interface.
When I try to access it I got the error:
ERROR: Zend_Db_Adapter_Exception: SQLSTATE[HY000] [2002] No such file or > directory
Additionally, an exception has occurred while trying to report this error: > Zend_Exception
No entry is registered for key 'translate' (Abstract.php:144)
The server is on Debian 7 wheezy.
I can still log in using ssh and when I did so a few hours back I realized that mysql was totally missing. I don't know how it's possible but it looked like the package was removed.
Without mysql, no web interface for plesk, no repair utility, nothing works.
So I tried to reinstall it manually and got a lot of problems with packages not found and so on, it was a mess of searching on the web and trying for several hours.
Right now I'm to the point where I don't know what to do anymore, I have kind of installed mysql but it doesn't start, the server is totally broken and it starts to become worrying.
I did the following to install mysql :
cd /usr/src && sudo wget http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
dpkg -i mysql-apt-config_0.7.3-1_all.deb
sudo apt-get update
sudo apt-get install mysql-server
Now I've got mysql:
~# mysql
mysql mysqlbinlog mysql_config_editor mysqld_multi mysql_embedded mysqlimport mysql_setpermission mysql_upgrade
mysqlaccess mysqlbug mysql_convert_table_format mysqld_safe mysql_find_rows mysql_install_db mysqlshow mysql_waitpid
mysqlaccess.conf mysqlcheck mysqld mysqldump mysql_fix_extensions mysql_plugin mysqlslap mysql_zap
mysqladmin mysql_config mysqld-debug mysqldumpslow mysqlhotcopy mysql_secure_installation mysql_tzinfo_to_sql
But when I try to start it:
~# sudo service mysql start
Pas de répertoire, connexion avec HOME=/
.190604 07:42:02 mysqld_safe Can't log to error log and syslog at the same time. Remove all --log-error configuration options for --syslog to take effect.
...................................................................................................................................................................................
[info] MySQL Community Server 5.6.40 did not start. Please check logs for more details..
The manipulation that may be at the origin of the incident it that we accidentally filled up the rootfs partition (the usage was 100% for maybe an hour or so).
So we started to receive weird error in the shell about missing storage space.
And that's where we may have made a mistake, we executed some commands to free some space (without thinking for one second they could remove such an important package as mysql....) :
apt-get clean
apt-get autoremove --purge
apt-get autoclean
If I remember correctly, none of these commands actually did anything, they all returned that no package have been uninstalled (I didn't pay much attention at the detail of the output so I could wrong but I have a strong conviction).
rootfs was in fact filled up by a huge archive downloaded in the wrong directory: /tmp instead of /var/tmp. The archive was 10GB.
After removing it, the fs looks ok:
~# df -h
Sys. fich. Taille Util. Dispo Uti% Monté sur
rootfs 20G 6,9G 12G 38% /
/dev/root 20G 6,9G 12G 38% /
devtmpfs 32G 0 32G 0% /dev
tmpfs 6,3G 856K 6,3G 1% /run
tmpfs 5,0M 0 5,0M 0% /run/lock
tmpfs 13G 0 13G 0% /dev/shm
/dev/md3 2,7T 1,7T 857G 67% /var
I gave you a lot of details, sorry for the long post, but the situation is desperate right now.
Thanks for your time.
I'm trying to mysql, but I'm receiving this error:
sudo /etc/init.d/apache2 start
* Starting web server apache2 *
ubuntu#ip-172-31-19-47:/var/www/html/anunciolocal$ sudo /etc/init.d/mysql start
* /etc/init.d/mysql: ERROR: The partition with /var/lib/mysql is too full!
When I checked my memory:
ubuntu#ip-172-31-19-47:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 996M 12K 996M 1% /dev
tmpfs 201M 344K 200M 1% /run
/dev/xvda1 16G 15G 307M 98% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 5.0M 0 5.0M 0% /run/lock
none 1001M 0 1001M 0% /run/shm
none 100M 0 100M 0% /run/user
overflow 1.0M 992K 32K 97% /tmp
How do I solve it?
Try running it this way
sudo service mysql stop
sudo service mysql start
/etc/init.d/mysql: ERROR: The partition with /var/lib/mysql is too full!
this is why you cant start mysql
please clear /dev/xvda1 the disk has no enough space
My system is using Ubuntu with mysql database:
I have a complex mysql select query to run.
mysql -u root -p myDB < query.sql
But when I try to run it it always gives me:
ERROR 3 (HY000) at line 1: Error writing file
'/mnt/disk/tmp/MY0Wy7vA' (Errcode: 28 - No space left on device)
I have 11 GB free on disk and while the query is running, I keep track of it using
df -h
and
df -hi
to keep track of inodes
and I don't see any decrease in disk space while the query is running. All the time there is always 11 GB free on disk where the tmp folder is located.
This is the output of df -h:
ubuntu#ip-10-0-0-177:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 799M 57M 742M 8% /run
/dev/xvda1 30G 24G 5.4G 82% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/xvdf1 50G 39G 11G 80% /mnt/disk
tmpfs 799M 0 799M 0% /run/user/1000
This is the output of df -aTh:
Filesystem Type Size Used Avail Use% Mounted on
/dev/xvdf1 ext4 50G 39G 11G 80% /mnt/disk
Take a look at the part of the error that indicate it’s actually writing to /tmp (see below)
: Error writing file '/mnt/disk/tmp/MY0Wy7vA
In some Linux distributions, /tmp is mounted as a tmpfs (ramdisk), so even if your disk has plenty of space you can get a "no space" error if you try to write too much there.
To investigate about the mount, try
$ cat /proc/mounts
OR
$ cat /proc/self/mounts
Or better yet
df - aTh
df -h /tmp
To see hidden ones, try
du -sc * .[^.]* | sort -n
Among other things you can try making MySQL use a different temp directory, or to not use tmpfs for /tmp
If TMPDIR is not set in my.cnf, MySQL uses the system default which is usually /tmp
You can change the MySQL tmp dir as the following suggests:
Changing the tmp folder of mysql
Credits ::
https://github.com/LogBlock/LogBlock/issues/540