I have a very strange issue wth mySQL.

Yesterday a Db from a server was disappear.

if I log on to phpmyadmin panel i see the DB on the left side menu of phpmyadmin panel but if try to open it (click on it) i got the error "No database slected".

If i run show DATABASES; i see it on the results, but i can't do any operation with that name.

I tried to run (from command line from the server)

mysqlcheck -u root -p -A 

(that would check all databases), but the first message i recieve is

mysqlcheck: Got error: 1049: Unknown database '<db_name>' when selecting the database

And the procedure stop itself without continuing with other DB.

The problem is that i can't restore or recreate it, because the name seems to be in tables schema of mysql.

Any suggestion on what's happen and how to solve it? I simply want to clean my situation and remove the "corrupted" DB from the databases list

  • Check according directory in the datadir. Does it exists?
    – Akina
    Commented Feb 5 at 18:18
  • I looked for the datadir key in my.cf file to see its location, but it doesn't exist. So I guess I need to find it in /var/lib/mysql. In /var/lib/mysql I will see ibdata1 and the all databases folder. I see that the DB folder name probably has the hexadecimal value, in fact I see "nameofDB@0022H" instead of "nameofDB-H" (as i see on phpMyAdmin panel) Maybe the problem is that in the DB name there is the special character "-" (minus).
    – Andrea_86
    Commented Feb 7 at 11:10
  • I looked for the datadir key in my.cf file ?? As I understand the server starts, and it is accessible. Simply look at SELECT @@datadir;. in fact I see "nameofDB@0022H" instead of "nameofDB-H" You may try to stop MySQL, rename folder then start MySQL and check for DB accessibility.
    – Akina
    Commented Feb 7 at 11:24
  • SELECT @@dirdata; returns '/var/lib/mysql/'. I tried the shutdown/rename operation. Now the folder has the correct name, but from phpMyAdmin the name I see in the DB trees is #mysql50#dbname-H and it is still inaccessible.
    – Andrea_86
    Commented Feb 7 at 15:13
  • SELECT @@dirdata; returns '/var/lib/mysql/'. ?? MySQL does not know about dirdata option variable.
    – Akina
    Commented Feb 7 at 16:39


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.