Mysql – Moved database (percona thesql) to larger disk, now everything is missing (though the files exist)

configurationMySQLpercona-server

I dont know anything about databases or MySQL beyond the absolute basics so lets start with that. I moved the /var/lib/mysql from the / to a mounted volume which I remounted as /var/lib/mysql after moving the files to temp storage.

Ok, now when I go to my sites, its like they dont have any database attached to them. WordPress wants to reinstall, other sites cant connect to their databases either.

When I go to the file system directly (/var/lib/mysql) and look for the files, I see that they are in their respective directories (I even restored from a backup just to be extra sure the files were there).

I have tried to repair and check the tables. But it keeps saying that some of the tables dont exist.

I am totally lost and frustrated.

Best Answer

Ok, after about a billion headaches I finally figured out what was wrong. Here it is: Some tables are MyISAM and some are InnoDB. I didnt know that when I started, which would have totally helped. So, what ended up happening is that when I moved the files to a temp directory, I guess I messed up the InnoDB tables alignment or whatever you call it, anyway the results where that all the sites that were InnoDB didnt work because I didnt do proper InnoDB moving and it couldnt find those tables.

So what I eventually realized is that I had been making backups of the database and that I could probably restore the database and get the InnoDB tables back inline where they should be. So what I ended up doing was mounting a new disk at /var/lib/mysql and then restoring the databases from a backup onto the new filesystem that was mounted for /var/lib/mysql.

Once that was done, I restarted MySQL and it is now running like nothing ever changed. Geesh.. what an adventure!