mysqljoomlaphpmyadminxamppmysql-error-1146

How to load mysql database from data folder?


I created a joomla website and started preparing to export it to the remote host - mainly working on the remote server to fix the directory tree. However, when I prepared to export the database with phpMyAdmin, it is not there. I tried to query it in the command line and I get a "unknown database" error, as if it does not exist. The database folder is still in /data, so it was not deleted. I am really unable to comprehend this as just a few minutes prior to that, the website was working and the database was listed in phpMyAdmin. Is there a way for me to import the database back in? I have the database's folder with the .frm files in it, as well as a db.out file. I have to say that this is not the first paranormal issue that I have encountered since starting out with MySQL and Joomla. Basically every time my PC is restarted, the MySQL service denies the password I supply it with for 1-2 hours. I fixed this by resetting the password, and the website and database was running fine after that. I am using Windows 7 with XAMPP for development on local host and MySQL is installed as a service. Joomla's version is 1.6. Thanks in advance.

EDIT I tried uninstalling XAMPP and completely erasing everything in its directory, then installing again and copying the database's folder into the new data directory. While I am able to see the database by connecting to mysql with mysql workbench, all the tables are listed as having 0 KB size and I get error 1146 (table does not exist) if I try to open a table or when I tried repairing the database. This is getting really ridiculous.


Solution

  • I managed to fix it; but still not sure how. I made a clean installation of XAMPP (before that I made full backup of the xampp/mysql/data folder), then connected to the mysql server with MySql Workbench. I created a database with the same name as the old one. Then I copied the /data/mydatabase files in the new database's folder. Finally, I copied the ibdata1 from the old /data folder to the new one. This did not work the first time because I had not copied the db.out file from the old /data/mydatabase to the new one. The tables would show in MySqlWorkbench, but any attempts to do anything on them (open, query, or dump) resulted in an error 1146. I was able to make a sql dump file, which uploaded without a problem on the server.