52

Xampp error after moving xampp folder:

enter image description here

Apache is running fine:

enter image description here

as given below image i'm sucess to run apache but unable to run mysql if in case i moved and run xampp both apache and mysql but its shows error which is fresh and it show the error like "Table doesn't exist in engine" #1932 as given up image. please solve the issue anyone help pls

Shadow
  • 33,525
  • 10
  • 51
  • 64
Yagya Bashyal
  • 531
  • 1
  • 4
  • 6
  • Check whether you have any luck with this [post](http://stackoverflow.com/a/33925030/5850835) and this [post](http://stackoverflow.com/a/25040628/5850835) – Thush-Fdo Aug 04 '16 at 09:07

18 Answers18

67

Copy the ib_logfileXX and ibdata file from old mysql/data folder to the new mysql data folder and it will fix the issue

Nava Bogatee
  • 1,465
  • 13
  • 15
55

I have faced same issue and sorted using below step.

  1. Go to MySQL config file (my file at C:\xampp\mysql\bin\my.ini)
  2. Check for the line innodb_data_file_path = ibdata1:10M:autoextend
  3. Next check the ibdata1 file exist under C:/xampp/mysql/data/
  4. If file does not exist copy the ibdata1 file from location C:\xampp\mysql\backup\ibdata1

hope it helps to someone.

Rohan Patil
  • 1,865
  • 1
  • 23
  • 36
13

If you have copied & Pasted files from an old backup folder to new then its simple. Just copy the old ibdata1 into your new one. You can find it from \xampp\mysql\data And restart your mysql.

Jay Momaya
  • 1,831
  • 19
  • 32
9

Don't copy ibdata1 file

This occurred to me when I take all files from the backups folder. There is a file you should not copy with other folders and files, called ibdata1.

Abd Abughazaleh
  • 4,615
  • 3
  • 44
  • 53
  • This means we cannot copy the table folder only for backup or other purposes. It needs to be copied all data folder instead. – GeneCode Nov 22 '21 at 09:39
8

I have faced same issue but copying the xampp\mysql\data\ibdata1 was not solved my problem, because I install new version of xampp, if you upgrading your xampp first make backup from all htdocs and mysql folder, in my case I just backup the all xampp to the new folder like old-xampp then install new xampp and then you need do the following steps before starting your new xampp servers:

  1. Backup the phpmyadmin folder and ibdata1 from your new installation form this location xampp\mysql\data.
  2. Then Go to your old xampp folder old-xampp\mysql\data and copy the ibdata1 file and phpmyadmin from old location.
  3. Then open your new xampp folder xampp\mysql\data and past them there.
  4. Start the xampp servers.
Nazari
  • 438
  • 1
  • 9
  • 20
8

You could:

  1. Rename data folder to data-old
  2. Create new folder and set name to data
  3. Copy backup folder in data folder
  4. Copy ibdata1 in data-old to data folder
  5. Restart MySQL and Apache

After solving the problems, get output power from the database

Waldi
  • 39,242
  • 6
  • 30
  • 78
  • copying ibdata1 from old folder bring the problem back. if i delete this file then run mysql it is created automaticall and problem is solved. – MindRoasterMir Dec 03 '22 at 17:53
7
  1. stop mysql
  2. copy xampp\mysql\data\ib* from old server to new server
  3. start mysql
kan
  • 71
  • 1
  • 1
2

I had previously moved my mysql directory and forgot to change ALL references to the old location in \mysql\bin\my.ini.

change these three lines:

datadir = "/programs/xampp/mysql/data"
innodb_data_home_dir = "/programs/xampp/mysql/data"
innodb_log_group_home_dir = "/programs/xampp/mysql/data"

Change "/programs/xampp/mysql/data" to new location this one was commented but I changed it anyways

#innodb_log_arch_dir = "/programs/xampp/mysql/data"
Zurupupz
  • 335
  • 2
  • 12
2

ok step one you can copy from your old xampp xampp\mysql\data\ibdata1 and step two paste to your xampp new xampp\mysql\data\ibdata1 , and than open your xampp controller and stop mysql and start again.

i tried this and is work for me

Taufik Hasan A
  • 176
  • 1
  • 3
2

100% working solution

  1. Stop MySQL and Apache and quit Xampp.
  2. Make a backup of the "data" folder.

C:\xampp\mysql\data

  1. Copy all the files from this folder

C:\xampp\mysql\backup 4. Paste and replace to

C:\xampp\mysql\data
Ahsan Najam
  • 155
  • 1
  • 8
1

Instructions for Ubuntu users:

  1. Copy a database (e.g. from the external disk backup).

    sudo cp -r /media/some_user/mysql/some_database/ /opt/lampp/var/mysql/

NOTE: from this moment on, the database already appears in PHPMyAdmin, but if you click on it, the tables still do not appear

  1. Change the owner to mysql (because when copying the owner it was changed to root)

    sudo chown -R mysql:mysql some_database/

NOTE: from this moment the name of the tables appears but you can't see their structure or data - it shows the error "#1932 - Table 'some_database.some_table' doesn't exist in engine"

  1. Copy the ibdata1 file and also change the owner.

    sudo mv ibdata1 ibdata1_old

    sudo cp /media/some_user/mysql/ibdata1 /opt/lampp/var/mysql/

    sudo chown -R mysql:mysql ibdata1

  2. Restart XAMPP

    sudo /opt/lampp/lampp restart

SandroMarques
  • 6,070
  • 1
  • 41
  • 46
  • Legend, Thank you man, saved my day!! i copied the old ibdata1 to mysql in the new installation folder and made it owner and it worked. – zakaria kasmi Dec 24 '22 at 04:48
0
  • Copy the content of backups folder into data folder. This worked for me.
  • After this you have to reconfigure innodb files of your existent databases
Nagama Inamdar
  • 2,851
  • 22
  • 39
  • 48
lsfiege
  • 17
  • 4
  • 8
    Welcome to Stackoverflow. Would you mind extending your answer little bit more, for fellow programmers, to understand how it helped to solve the problem. – Nagama Inamdar Dec 28 '16 at 04:42
  • 2
    Can you explain your second point? Because first point worked for me and now I lost all the data. I can see the list of tables but when I click on any, says table does not exists in the engine. – Vipul Hadiya Sep 11 '19 at 06:32
  • @VipulHadiya did you find any solution? I am currently stuck with the same problem as yours. – Raju Ahmed Sep 15 '20 at 12:03
  • @RajuAhmed No, fortunately, I had backup of every single database so I have deleted them all and imported all SQL one by one. – Vipul Hadiya Sep 15 '20 at 16:06
  • @VipulHadiya Yes - this is, also, the best solution I have found also but very time consuming. Having gone through this about 3 times in the past few years. I'm looking for an explanation of how the tables get deleted in the first place and whether there are maintenance steps I can take to prevent that. – FeralReason Jun 24 '22 at 18:38
0

I had the same issue. I had a backup of my C:\xampp\mysql\data folder. But integrating it with the newly installed xampp had issues. So I located the C:\xampp\mysql\bin\my.ini file and directed innodb_data_home_dir = "C:/xampp/mysql/data" to my backed-up data folder and it worked flawlessly.

milanbalazs
  • 4,811
  • 4
  • 23
  • 45
Abu Mutea
  • 1
  • 1
0

None of the above solution works for me. After pasting your old mysql/data directory to your new xampp, Check if ibdata1 has all the permissions required by the current user otherwise try to grant the permissions. Then "Empty Session Data" in your phpmyadmin, solved my problem.

Jerry Sam
  • 91
  • 1
  • 6
0

If you have tried all the above answers and yet failed, first try to fix your db by running this command,

mysqlcheck --repair my_db_name -u root -p

And then if issue fixed,

If not fixed and you have a backup of the table with you and not able to import it to the PHPMyAdmin, do the following.

1. Go to xampp\mysql\data\database_folder

2. Delete the files (with extension .frm and .ibd) starting with your table name. Eg: my_table.frm, my_table.ibd

3. Import your table

It worked for me.

Jopsy
  • 145
  • 1
  • 8
0

I found the following answer at https://stackoverflow.com/a/66804621 helpful

If you are just moving your DB from one folder to another folder, but your InnoDB tables no longer work, because they can't be found and the error message "Table does not exist in the engine" is displayed, then these pair of SQL statements can be as quick as helpful:

ALTER TABLE __yourtable_name__ DISCARD TABLESPACE ;

ALTER TABLE __yourtable_name__ IMPORT TABLESPACE ;

In pratice, the .IDB file is detached from .FRM file and then bound again, so that table contents turn into readable.

It worked in my case. Hope yours too.

M.Ali El-Sayed
  • 1,608
  • 20
  • 23
0

Try these steps

  1. stop mysql and apache server
  2. copy backup folder
  3. copy database folders from data folder to backup copy folder
  4. delete ibdata1 from backup copy folder
  5. copy ibdata1 from data folder to backup copy folder
  6. delete data folder
  7. rename backup copy folder to data folder
  8. restart the xampp server
Toki
  • 268
  • 3
  • 10
-2

For me I removed whole data folder ( and took a backup ) from xampp\mysql\ and pasted data folder of previous one here which solved my problem...

Muhammad Bilal
  • 497
  • 1
  • 5
  • 12
  • 3
    Your solution delete my entire database table – STA Mar 20 '21 at 13:42
  • 1
    Please before you do this, backup the content of the data folder somewhere. Mysql creates folders that keeps files needed by your databases to work. – Cyril Ikelie Jul 29 '22 at 13:05