URGENT HELP*** MySQL Socket Error (2) SQLSTATE [HY000]

Hi Guys,

I am hoping you can offer me some help on this as my entire phone system has gone down. I upgraded some modules on my FreePBX system a few days ago and was unaware that there was insufficient storage space. It continued to reboot the system after the module updates and since rebooting i realized the storage was full as it came up with an error. I have since upgraded the storage from 8GB to 20GB so should be plenty of breathing room on there. However, the issue now appears to be a SQL database error. I have tried my best to look into this myself and have tried many things such as trying to repair the database etc. Before you ask, unfortunately i do not have any back ups of the system. I have attached photos of the errors i am getting both from the CLI and the Web GUI.

The system is running in a Hyper-V environment within Windows Server 2012. It is assigned 1536 Mb of RAM and 20GB of storage. It has been running well for a couple of years and i have never had any issues.

SQLSTATE [HY000] [2002] Can’t connect to local MySQL server through socket ‘var/lib/mysql/mysql.sock’ (2)

SQLSTATE [HY000] [2002] Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2) in file /var/www/html/admin/libraries/utility.functions.php on line 204

Firewall was unable to connect to MySQL after 30 seconds. Check Database!

Any Help is much appreciated!

Looks like mysql isnt running:

The following command will tell you if it is running or not:

mysqladmin -u root status

mysqladmin -u root status
Uptime: 1850802  Threads: 5  Questions: 20886489  Slow queries: 0  Opens: 70944  Flush tables: 1  Open tables: 63  Queries per second avg: 11.285
1 Like

Hi David,

Thanks for the speedy response. I have put the following command and got the output which i have attached a screenshot of. Hopefully you can make more sense of this than me & help me resolve this.

make sure you have enough free disk space

df

(allocating a bigger disk space doesn’t make the partition bigger)

if no space , remove files in /var/log/* that end in .0-9 , that should give you enough space to repair your mysql databases and restart mysql, there are other threads here that tell you how to do that.

Yes, MySQL isn’t running. You need to start it.

systemctl start mariadb

(if you’re on Distro. If you’re not, you just start it however your distro starts it)

Hi Dicko,

Thanks for your input. Looks like you’re 100% right! The disk usage is still 100%. Is there any way to make the /dev/sda2 partition larger? As i’ve assigned more storage to the VM but it hasn’t expanded the size of this partition.

I have attached a photo of the contents of the /var/log directory. Can you tell me which ones would be good to delete? Also, remind me of the command which does a repair of the mysql database?

Thanks!

Hi Rob,

Welcome to the thread! It seems systemctl command is not found. I tried just the start mariadb command and got a response of Unknown Job: mariadb

Also tried ‘start mysql’ and ‘start mysqld’ but they are unknown jobs.

try ls -lh

This is vmwares view on the world: https://kb.vmware.com/s/article/1006371 - im not sure how it applies to freepbx etc.

I would use scp to take of copy of everything above that is -20xxxxxx, then delete the files from /var/logs

start with all the files with 2018 in the name, there are probably bigger ones in /var/log/asterisk/

expanding the partition is probably bets done by booting from a ‘live linux’ distro with gparted on it and running that , I suggest

https://www.archlinux.org/download/

for a distro

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