Question

WP database present on SFTP but can't see it when I run SHOW DATABASES; on CLI

I was facing some issue with mysql so I had uninstalled it completely and then reinstalled it again.

So, when I went to my website now it was giving me “Error Establishing Database Connection”

Just to confirm everything I check show databases on sql

And I got this output:

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

instead of this:

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

I don’t why this is happening even though I can see wordpress file in /var/lib/mysql/

Does anyone what is causing this issue? And how can I resolve it?

Thanks!


Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
May 12, 2022

Hello,

Would you mind sharing more information on how did you restore the database after reinstalling the MySQL service?

Usually what I would personally do is:

  • First create the database by running the following SQL statement:
create database wordpress;
  • Then import my .sql backup:
mysql -u your_database_user -p wordpress -h localhost < your_backup_file.sql

Let me know how this goes.

Best,

Bobby