Is there any method by which I can recover my MySQL database? - mysql

I had a Database in my localhost. After another developer uninstalled the XAMPP from my mac, I have re-installed it but the my database seems to be corrupted. Is there any way I can recover my database? Whenever I click any one of the tables of my databse it says "#1932- Table "database.table_name" doesn't exist in the engine".
I have already tried some other solutions like where they say the ibdata1 file is missing. But I already have that file. What can I do now? In mac I couldn't find my backup files as this is a new installation. I only have that previous .sql file of my database but it says it is not in the engine.

Related

WAMP: using .MYD, .frm , .MYI , db.opt to restore database

Some days ago I forced to uninstall my wamp cause I didn't have any access to phpmyadmin, so that I just copy the MySQL folder of that damaged wamp before uninstalling to have databases to reuse them later
Now I installed a new version of wamp and when I pasted the databases file such as .MYD, .frm , .MYI , db.opt in the data folder of MySQL wamp, in phpmyadmin I can see the tables but when I wanted to see the columns I got this error:
#1146 - Table 'Databasename.table_name' doesn't exist
Please tell me whats wrongs with them? is there any way to use my old databases? If attaching database files is needed to tell me to do that...
luckily the problem solved by my self!
I did it in the simplest way! just deleted last MySQL folder which was the newer version of MySQL and pasted that previous MySQL folder in it, then just edit the my.ini file and correct the wrong address and folder names
Don't forget to restart the services
for my self, there was no need to do something with MySQL command line which some friends said to do
if you think deleting MySQL folder could be riskable install a new wamp which has got as the same version of previous damage databases...
So the version of both databases have to be the same, especially when your database engines are InnoDB
hope be helpful

How to restore database in MySQL/phpMyAdmin?

I was using the MAMP program to host my database locally on my laptop. I had a problem so I had to reinstall the MAMP software. Before I did that though, I copied my entire MAMP folder from my C drive to my desktop. Now that I have MAMP installed, I opened the startpage and then went to phpMyAdmin.
I want to know how I can restore my database? When I opened phpMyAdmin after reinstallation, I could see the database and the name of the tables. But when I click on the tables, it says the table doesn't exist. When I tried importing the table, there was an error and it didn't work. Here is a screenshot of the error:
The copied database is in this location: C:\Users\MyUserName\Desktop\MAMP\db\mysql\DatabaseName. In the DatabaseName folder, there are the 3 tables which I had which have the .frm file extension. and then 1 file called db.opt. How can I restore the tables to my database?
Thanks in advance
Here is a solution. It works very well.
You just need to copy the ib_LogFiles and the ibData file and it should all be fixed!
https://stackoverflow.com/a/10943833/6183565

How can I recover sql tables from a broken Xampp

I made a mistake in my latest upgrade to Xampp, I copied my old Xampp directory to C:/Xampp - Copy but I forgot to export out the mysql tables. I then uninstalled xampp and installed the new version.
I tried to access the phpmyadmin from the Xampp - Copy folder but I cannot get access to it to dump its tables, is there anyway I can gain access to my old tables?
c:/xampp-copy/mysql/data
See This directory for your database tables.
if these are in unreadable format then i think problem is with your Database engine. Checkout the following guidelines.
InnoDB Backup and Recovery
Moving or Copying InnoDB Tables to Another Machine
See This Answer also. Import .frm and .opt files to MySQL
I managed to get it working through the new PHP My Admin, all resolved now.

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.

Attaching an existing database with MySQL

Disclaimer: I have never used MySQL before!
I have a folder containing a number of .frm, .myd and .myi files that I believe are a MySQL database. I have pulled these files from a defunct server for a client who has not used the server or database for some years but is now looking to resurect some of the data for a new venture.
I have downloaded the latest free edition of MySQL, along with MySQL Workbench and am looking to connecct the existing database to the new installation; the equivalent to an "Attach" if I were using MS SQL Server.
I have found a few articles that say if I simply copy the folder into the data folder for MySQL and restart the service the database will show up. I have tried this (using both the data folder within the installation folder and also the "MySQL Datafiles" folder created during the intial configuration but when I restart the service nothing shows up.
How should I go about attaching this database?
Ok. I found the answer, the folder I was adding the database to was the wrong one.
Though I had found 2 "data" folders, there was a 3rd hiding in C:\ApplicationData; once I added my data files in here and restarted the MySQL service I could see the data.
On Windows 8 the default folder where MySql databases are stored is:
C:\ProgramData\MySQL\MySQL Server 5.6\data
5.6 is the version.
Please note it is ProgramData not Program Files which is easy to overlook.
Copying there and restarting the service worked fine for me. I'm even copying the DBs from an earlier 5.X version.