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

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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