ERROR 2003 (HY000): Can't connect to MySQL server

mysql

#1

I was able to connect fine on Saturday, but I haven’t been able to since then. I think I’ve tried every combination I can think of.

mysql-ctl cli

I’ve tried both no password and my Cloud 9 password.
ERROR 2003 (HY000): Can’t connect to MySQL server on ‘127.0.0.1’ (111)
or
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (111)


#2

I would say try restarting your workspace. And the correct command should be
mysql-ctl cli


#3

When I do that command, it prompts me for a password.

I have tried both no password and my Cloud9 password. Both return this error:

ERROR 2003 (HY000): Can’t connect to MySQL server on ‘127.0.0.1’ (111)

I swear this worked on Saturday.


#4

I have 2 workspaces.

The mysql-ctl cli works for one, but not the other.

I’m wondering if the MySQL is somehow corrupted on my 2nd workspace? And if it is corrupt, is there any way to fix it? I really don’t want to have to delete and recreate the workspace.


#5

Have you tried cloning the 2nd workspace?


#6

Hi,

Can you try running mysql-ctl stop and mysql-ctl start to stop and restart the MySQL server to see if that works?

Regards,
​Mutahhir


#7

The 2nd workspace is unrelated.

I tried running mysql-ctl stop but after several attempts kept getting this error message:

  • Attempt to shutdown MySQL Community Server 5.7.8-rc timed out

#8

I started having the same problem. I’ve done everything that’s been suggested. I was able to run stop, but when I run anything else after it either fails or asks for this mysterious password again.


#9

Can you try going through the steps found in this Stack Overflow topic? Also, is this a brand new workspace? Have you made any changes to the MySQL install in your workspace? Any other thoughts on what might have caused this?

And as Paul mentioned above, if you clone the workspace do you get the same error in the new one?


#10

This is not a brand new workspace. I cloned the workspace to no avail. I commented out the bind address then ran “service mysql restart” to no avail. I also tried changing the bind_address to 0.0.0.0 and that didn’t work either.

I tried “sudo apt-get --reinstall install mysql-server” which worked, but then I ran “service mysql restart” which still failed. If I remove sudo and run “service mysql restart” then I got the warning:

"df: ‘/var/lib/mysql/.’: Permission denied

  • /etc/init.d/mysql: ERROR: The partition with /var/lib/mysql is too full!"

My only guess is having not having enough space on the disk due to the error above. My workspace is now 9095MB/10240MB. Any suggestions?


#11

Try following the instructions in the following post to find the largest unnecessary file:


Hopefully that can clean up enough room that you won’t see that error anymore.


#12

I tried that, and deleted stuff in my workspace folder so that I’m down to 9065MB, but there’s not enough big files besides my ibdata1 mysql file, but I can’t delete that. I could delete some tables from that file, but I can’t login to mysql.

I’m not entirely sure the size is the issue either as I have a little space and plenty of memory - it was only a guess because I added a few thousand rows from the day before.


#13

@bradydowling @mutahhir Has there been any update on this problem? I am having the same error as I can’t connect to my database, and throws a timeout error whenever I try and stop the connection (mysql-ctl stop).


#14

my.cnf files are read only and root permission is needed for any changes.


#15

This solved the problem on my case guys, hope it can help you. @mpirjaberi helped
sudo chmod 0644 /etc/mysql/my.cnf