Restore SQL database from backup of "C:\xampp\mysql\data" folder - mysql

Recently my laptop crashed and while making a backup of the XAMPP instead of taking a backup of the entire XAMPP folder I just copied the
"C:\xampp\mysql\data"
folder.
Now I am trying to restore the old database, the issue is if I try to just paste the folder of the database (Eg database folder named 'X123' - it cotains both ibd and frm files), then X123 shows up in PHPMyadmin but doesn't work as when I click on the table it says 'table doesnt exist'. I read other answers which suggested that I also replace the following files
ibdata1, ib_logfile1, ib_logfile0
When I try to do the same, MySQL simply stops working.
I have tried fixing the errors after reading some of the related answers here by importing the create_tables.sql file from "C:\xampp\phpMyAdmin\examples" and some other stuff but nothing seems to work.
I would really appreciate if you can guide me as to what would be the best way to restore this data on Windows 10.

I was able to find the solution on another answer at stackoverflow. Apologies for double post.
https://stackoverflow.com/a/46970116/9879647
In my case I also had to edit php.ini so as to increase the max execution time as well as file size that can be imported.

Related

Recovering a XAMPP database with ibdata1, .frm and .ibd files

Thanks for looking!
I've tried pretty much every solution I found online, yet nothing recovered a full database.
My client had a crash of MySQL on her XAMPP, and sent over the mysql/data folder along with WP root directory(it's a WordPress website).
-she erased the mysql/backup folder
-I've tried copying ibdata1, .frm and .ibd files into fresh XAMPP, but then I get the "Table doesn't exist in engine" error in PHPMyAdmin
Also tried SysInfo MySQL Database Recovery tool, which extracts the database when pointed to database folder, and without loading ibdata1. If I load ibdata1, tables are empty. If I point the software to the database directory, I get a full database, but with a few weird issues. Some are in wp_posts table(,, instead of ,'',) which brakes the element count, but I hopefully patched it. However, some other things are not showing well, all IDs are like "-9223372036854775555", and slugs have weird characters, like "a-lepsi-jutri��u癮u�".
Post statuses look messed up as well(like "itclosedclosedsta").
On WP side, this manifests as a 404 homepage error. You can access wp-login.php, but after entering the details and trying to login you get redirected to the homepage 404.
When I replace the entire mysql folder in fresh XAMPP with a backup from my client, MySQL won't start.
Have also tried starting it with repair level 1-6, but MySQL still won't start.
Have tried creating a fresh database, adding tables and fields with .frm files, discarding TABLESPACE then copying over only .ibd files and importing TABLESPACE. This works only for empty tables.
Also some other things, but nothing worked so far.
Any WP or DB thoughts - please let me know :)

MySQL Tables Could Not Be Read

I'm using Appserv for local MySQL hosting. I had to reset my computer. I forgot to make backup for MySQL database and used Win 10 reset feature. So it removed all the applications but not personal files. After resetting my pc, I set up the Appserv again. I got into phpMyAdmin. On the left side, I can see all of the tables. But when i click on them, I'm having an error message "#1146 - Table 'database.table' doesn't exist". So i only have the MySQL data files which has database's .frm and .ibd files.
My question is, can i recover tables with these .frm and .ibd files?
Note: ib_logfile and ibdata files are overwrited after setup.
A quick search on Google I found an article that may help you but bear that in mind that once you erase something permanently by mistake or otherwise and if you haven't made the appropriate backups then I am sorry to say that whatever you do to try and resurrect it won't work.
Nevertheless, try out the link below and let me know of your progress:
http://www.voxteneo.com/restoring-tables-mysql-database-frm-ibd-files-available/

How to change mysql database directory on Xampp?

I have my old databases in D:/data and I just did a fresh install of xampp in C:/xampp, I've changed to datadir = "D:/data" in my new my.ini file but it doesn't work properly.
PhpMyadmin shows all my old databases, but when I try to delete one it says it's corrupted, and my php files doesn't connect to my databases...
What I'm doing wrong?
same thing happend for me also
It is because of You might forgot to copy the ibdata* file. You may expect this file to be located within the respective database folders just like the other related files, but you would be wrong.
My ibdata file was located at mysql/data/ibdata1; as soon as I copied that to the new location everything was good again.
Hope it will help!! :)

Restore MediaWiki site from physical files (MySQL)

One of our servers crashed last week and it wouldn't boot. So I got a full copy of the whole file system, and restored a previous backup. Now it is up and running, but there is a problem: the most recent changes made to a MediaWiki site were lost (the backup is a month old). It's not much, just a couple of modifications to some articles here and there.
I am currently trying to restore the last MySQL tables of the site. The proper way of doing that is with the mysqldump command, but this is not an option because I can't boot the server, I only have the files. So I read that you can do it manually if you copy all files in /var/lib/mysql/[dbname]:
How to recover MySQL database from .myd, .myi, .frm files
Restoring MySQL database from physical files
etc
Well, I tried stopping the MySQL service and moving the files from the copy to the server, and I even granted the database user privileges again just in case, but it won't work. The site keeps showing the month old articles (yes, I have cleared the cache, and rebooted) and I don't understand why, because the files I am restoring clearly have their "last updated" field set to the date when the last changes to the wiki were made (I know that for sure).
Am I missing something here?
Problem solved thanks to user #che. I had to copy the whole /var/lib/mysql directory, not just /var/lib/mysql/[dbname]. Apparently some database information is also contained in those files.

XAMPP NOT WORKING! - OS X Yosemite

I was working with XAMPP 1.8.3-3 on OS X Mavericks. After upgrading to Yosemite Mysql server stopped working. And an upgrade to XAMPP 1.8.3-5 fixed the problem and mysql server starts working.
Now the entire database list is showing on phpmyadmin, but no access to the tables. Its showing “#1146 - Table ‘DB_NAME.TABLE_NAME’ doesn’t exist”.
Unfortunately I don't have any DB backup!
I have the entire XAMPP folder backup. So how I can able to retrieve the mysql tables?
just type /Applications/XAMPP/xamppfiles/bin/mysql.server start
in terminal then start xampp
you can restore if you have all the mysql folders from XAMPP folder. (check /XAMPP/xamppfiles/var/mysql in backup)
if you have var/mysql folder, open and look for database names you had earlier.
there is a separate folder for each database you had earlier. open the folder and it will contain lots of files with table names.
if your old table engine is InnoDB you will see 2 files. with .frm and .ibd extensions.
or if you had MyISM it will contain three file per table which has .frm, .MYD and .MYI extensions.
after you verify you have all the required files in backup, you can start restoring them.
stop mysql
copy required database folder completely and paste it to currently installed folder. (/Applications/XAMPP/xamppfiles/var/mysql/)
start mysql
to restore web files, open htdocs folder in backup and copy required site folder to currentely xampp installed htdocs folder.
This solution worked for me. Good Luck !
Do a clean install. See my answer for my own question. xampp mysql server not starting. The bad part is that I'm not sure if it will save your database the way I explained. What you might try is going to xampp > xamppfiles > var > mysql > 'your database name' and making a copy of the database folder on your desktop and moving it back once you reinstall it. I tried and I think it might have worked had I changed the file permissions. You can also try experimenting to see if it preserves the database if you do this. I would do some serious testing if you really want to save your database before doing this.