Getting Error while reinstalling MYSQL

I had my disk space full due to which I couldn’t delete binary logs using sql command. So, I took a backup deleted some bin files manually using SFTP. After this mysql start messing up, so I uninstalled and installed again but it isn’t working.

I ran following code to uninstall:

sudo apt-get purge mysql
sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql

And for installing I followed this tutorial:

And now I getting an error

“Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)”

Please help me out


It worked but not my wordpress database isn’t showing up

When I ran show databases query the output was without wordpress

mysql> show databases;
| Database |
| information_schema |
| mysql |
| performance_schema |
| sys |

Is there any way to show wordpress as well?

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Hi there,

I could suggest following the steps from this answer here on how to completely uninstall MySQL:

Let me know how it goes after that.

And if you are still seeing the error, can you check the MySQL status with:

sudo systemctl status mysql

And also check your MySQL error log and share the output here?