mysql stops working
mysql stops working
For some reason my database stops working without really a reason. I looked already in the mysql logs, but they are empty.(mysql.err and mysql.log) Where can I find other clues for this problem. I use Ubuntu 14.04 and I think the problem started after the firewall update.
Re: mysql stops working
If any service stops, there is a reason. Simple as that. You might want to check /var/log/mysqld.log
Re: mysql stops working
I'm sorry for the late reply. I had the same problem as this person. The same logs.
I resolved the problem with a ram upgrade. From 1gb to 2gb. I think vestacp is using more resources after the firewall update because I see a lot of people on this forum with similar problems.
I resolved the problem with a ram upgrade. From 1gb to 2gb. I think vestacp is using more resources after the firewall update because I see a lot of people on this forum with similar problems.
Re: mysql stops working
If you are running on a 0 Block VPS and only have 512MB of RAM, you may need to perform some tweaks, we recommend that you:
SSH into your VPS
Type: nano /etc/mysql/my.cnf
Modify the file to look like this:
[mysqld_safe]
socket=/var/run/mysqld/mysqld.sock
[mysqld]
user=mysql
pid-file=/var/run/mysqld/mysqld.pid
socket=/var/run/mysqld/mysqld.sock
port=3306
basedir=/usr
datadir=/var/lib/mysql
tmpdir=/tmp
lc-messages-dir=/usr/share/mysql
log_error=/var/log/mysql/error.log
max_connections=200
max_user_connections=30
wait_timeout=30
interactive_timeout=50
long_query_time=5
performance_schema = off
# CACHES AND LIMITS #
tmp-table-size = 32M
max-heap-table-size = 32M
query-cache-type = 0
query-cache-size = 0
max-connections = 500
thread-cache-size = 50
open-files-limit = 65535
table-definition-cache = 1024
table-open-cache = 2048
# INNODB #
innodb-flush-method = O_DIRECT
innodb-log-files-in-group = 2
innodb-flush-log-at-trx-commit = 1
innodb-file-per-table = 1
innodb-buffer-pool-size = 128M
USE A FILE AS A SWAP PARTITION
If you require a swap partition on your VPS, it's recommended to use a file based swap partition. To add one follow the below instructions.
The following dd command example creates a swap file with the name “myswapfile” under /root directory with a size of 1024MB (1GB).
# dd if=/dev/zero of=/root/myswapfile bs=1M count=1024
1024+0 records in
1024+0 records out
# ls -l /root/myswapfile
-rw-r--r-- 1 root root 1073741824 Aug 14 23:47 /root/myswapfile
Change the permission of the swap file so that only root can access it.
# chmod 600 /root/myswapfile
Make this file as a swap file using mkswap command.
# mkswap /root/myswapfile
Setting up swapspace version 1, size = 1073737 kB
Enable the newly created swapfile.
# swapon /root/myswapfile
To make this swap file available as a swap area even after the reboot, add the following line to the /etc/fstab file.
# pico /etc/fstab
/root/myswapfile swap swap defaults 0 0
Verify whether the newly created swap area is available for your use.
# swapon -s
Filename Type Size Used Priority
/dev/sda2 partition 4192956 0 -1
/root/myswapfile file 1048568 0 -2
# free -k
total used free shared buffers cached
Mem: 3082356 3022364 59992 0 52056 2646472
-/+ buffers/cache: 323836 2758520
Swap: 5241524 0 5241524
Note: In the output of swapon -s command, the Type column will say “file” if the swap space is created from a swap file.
If you don’t want to reboot to verify whether the system takes all the swap space mentioned in the /etc/fstab, you can do the following, which will disable and enable all the swap partition mentioned in the /etc/fstab
# swapoff -a
# swapon -a
This steps fix my problem
Source :
https://www.vpsblocks.com.au/support/Kn ... trol-panel
https://www.vpsblocks.com.au/support/Kn ... -partition
SSH into your VPS
Type: nano /etc/mysql/my.cnf
Modify the file to look like this:
[mysqld_safe]
socket=/var/run/mysqld/mysqld.sock
[mysqld]
user=mysql
pid-file=/var/run/mysqld/mysqld.pid
socket=/var/run/mysqld/mysqld.sock
port=3306
basedir=/usr
datadir=/var/lib/mysql
tmpdir=/tmp
lc-messages-dir=/usr/share/mysql
log_error=/var/log/mysql/error.log
max_connections=200
max_user_connections=30
wait_timeout=30
interactive_timeout=50
long_query_time=5
performance_schema = off
# CACHES AND LIMITS #
tmp-table-size = 32M
max-heap-table-size = 32M
query-cache-type = 0
query-cache-size = 0
max-connections = 500
thread-cache-size = 50
open-files-limit = 65535
table-definition-cache = 1024
table-open-cache = 2048
# INNODB #
innodb-flush-method = O_DIRECT
innodb-log-files-in-group = 2
innodb-flush-log-at-trx-commit = 1
innodb-file-per-table = 1
innodb-buffer-pool-size = 128M
USE A FILE AS A SWAP PARTITION
If you require a swap partition on your VPS, it's recommended to use a file based swap partition. To add one follow the below instructions.
The following dd command example creates a swap file with the name “myswapfile” under /root directory with a size of 1024MB (1GB).
# dd if=/dev/zero of=/root/myswapfile bs=1M count=1024
1024+0 records in
1024+0 records out
# ls -l /root/myswapfile
-rw-r--r-- 1 root root 1073741824 Aug 14 23:47 /root/myswapfile
Change the permission of the swap file so that only root can access it.
# chmod 600 /root/myswapfile
Make this file as a swap file using mkswap command.
# mkswap /root/myswapfile
Setting up swapspace version 1, size = 1073737 kB
Enable the newly created swapfile.
# swapon /root/myswapfile
To make this swap file available as a swap area even after the reboot, add the following line to the /etc/fstab file.
# pico /etc/fstab
/root/myswapfile swap swap defaults 0 0
Verify whether the newly created swap area is available for your use.
# swapon -s
Filename Type Size Used Priority
/dev/sda2 partition 4192956 0 -1
/root/myswapfile file 1048568 0 -2
# free -k
total used free shared buffers cached
Mem: 3082356 3022364 59992 0 52056 2646472
-/+ buffers/cache: 323836 2758520
Swap: 5241524 0 5241524
Note: In the output of swapon -s command, the Type column will say “file” if the swap space is created from a swap file.
If you don’t want to reboot to verify whether the system takes all the swap space mentioned in the /etc/fstab, you can do the following, which will disable and enable all the swap partition mentioned in the /etc/fstab
# swapoff -a
# swapon -a
This steps fix my problem
Source :
https://www.vpsblocks.com.au/support/Kn ... trol-panel
https://www.vpsblocks.com.au/support/Kn ... -partition
Re: mysql stops working
Thanks @jowox I am running a server with 1GB memory and this is happening. It seems to be happening to a number of people now as there are multiple threads about this in the forums. I'll try the tweaks and report back.
Edit: I can confirm that these tweaks and enabling swap fixes the MySQL mysteriously stopping problem for me.
Edit: I can confirm that these tweaks and enabling swap fixes the MySQL mysteriously stopping problem for me.
Re: mysql stops working
There no mistery, mysql eat too many in default configuration.phocks wrote: Edit: I can confirm that these tweaks and enabling swap fixes the MySQL mysteriously stopping problem for me.