Restore entire databases at once in localhost - mysql

Prior to the formatting of my PC, i backed up the entire database set through phpmyadmin.
Now when i am restoring my exported sql file, its showing me an error "#1046 No Database selected".
Going through many question answers, i got to know that i should have exported the databases one by one. But now the mistake has already happened, and i have no other alternative to backup the database again, i am left with the already backed up file of "Entire Databases of server".
How to recover them now?

Related

Export table from Xampp MySQL from file directory

I have an error with Xampp where it will not connect to my database. I have had this error several times in the past and no solutions have helped. I find that uninstalling and reinstalling ends up being the fastest method, however, by doing so I lose my database tables. As I have no access to the default export and import functions, I was wondering how I transfer the tables across.
Last time, I copied and pasted these files into the same directory when I reinstalled Xampp and the tables transferred but the data within did not. The tables had also lost some functionality as well.
If anyone has any methods to do this I will greatly appreciate it.
The best way to backup and restore your data is to dump the database to an SQL file. You can use the provided mysqldump tool for that, which is the best tool for the job.
Copying the entire MySQL "datadir" (which is probably one level up from the screenshot you've posted) and completely replacing one of your new stopped MySQL instance will probably work, but is not reliable and is not supported. Since there are other files (such as ibdata1) that handle the overall health and functioning of the entire MySQL instance, you can't only copy over individual database directories. Furthermore, you should only do this when the original and replacement MySQL servers/daemons/services are completely stopped because otherwise there are file corruption or concurrency issues.
Since you're running the server on your own computer, you should grant yourself sufficient access to be able to use mysqldump and use that regularly as a backup, since file-level backups of the data directory are not reliable.

Can't export MySQL database with PHPMyAdmin

I have a MySQL 5.5 database in a web hosting, which I access using PHPMyAdmin (the hosting provider doesn't give me shell access). I back the database up using the "Export" function in PHPMyAdmin.
Recently, however, whenever I try to run the backup, I get an interrupted DB dump, and I see in it a PHPMyAdmin backtrace saying that "MySQL: the server has gone away". The two solutions to this, as I understand it, are:
Changing the "max_allowed_packet" parameter in the server... but I can't do that.
Repair tables... but I checked the status of the tables in the DB, including the ones where the dump usually stops, and they all seem OK.
I can always back it up in chunks, but it's a hassle to do that when the DB has about 40 tables. What can I do to fix this?

phpmyadmin shows tables in the sidebar but tables don't exist

I re-installed wampserver 2.5 (with same stuff/settings - nothing changed) and after installation my database got corrupted. Few database tables exist and many of them are not accessible. On right frame it shows No tables found in database.
Even the sidebar of phpmyadmin shows my database table
but when I try to open any table it says:
To confirm whether tables exists in database, I go to
C:\wamp\bin\mysql\mysql5.6.17\data\db_blog
where I can see a long list of stuff. My tables are listed in 2 different formats frm and idb.
How can I repair my database? Please help me.
Before reinstalling wamp you should have done backup of database and after reinstall bring database back from backup. If after reinstall of wamp database is still available but seems to be corrupted then there you did something wrong with wamp reinstall as database should be purged or not touched, nothing in between. Now everything depends on what you want to achieve: you can purge databases simply using phpmyadmin or try to somehow restore database but it is possible only if you have backup of database, otherwise data is corrupted and can't be restored. You may try to repair database by following this article but do not expect miracles:
https://www.a2hosting.com/kb/cpanel/cpanel-database-features/optimizing-and-repairing-mysql-databases-with-phpmyadmin

Only was able to recover MySQL data folder (IBD, FRM, and OPT files), can I recover databases?

As title says, I had an unfortunate failure which resulted in me only being able to recover my MySQL data folder (IBD, FRM, and OPT files). I built a new server and installed MySQL 5.6 (old one used 5.5). I copied over the data folder hoping I would get lucky, and I do see my old schemas in MySQL workbench, but when trying to look at any table in them I get an error like this:
https://www.dropbox.com/s/q2eui8eyu621f3c/sqlerror.jpg?dl=0
I don't remember seeing any .data files on the recovered data and am wondering if it's possible for me to recover my old tables. I'm not sure whether or not the old or new is InnoDB or myisam and am not exactly sure how to tell.
Any tips appreciated.
In case someone else who doesn't know how to restore their databases runs into a similar issue, I was able to recover my data. Instead of copying and pasting everything in which did not work, I stopped the MySQL service, pasted all the database folders in, and only the "ibdata1" file. Then I restarted the service and loaded up workbench and all my data as restored in 5.6.

Restore MySQL from files (without dump)

Is it possible to duplicate a MySQL database from their files? [I know mysqldump would be the best method to duplicate a db, but that's not possible as all we have is the backed up files from the mysql folder].
We have the ibdata1 file, the ib_log* files, and the full directories for the three db's we want to restore from the backed up files (folders seem to contain all needed frm and par files). Obviously already tried just to copy all the files into /var/lib/mysql and though it appeared the structure was intact attempts to access the data were unsuccessful.
i.e. show databases will show the db's, use dbname works, and show tables properly displays the tables, but when trying to access the data from [any] table (via query) it says ERROR 1146 (42S02): Table 'dbname.dbtable' doesn't exist - despite mysql having happily showed us the table does exist when we did show tables.
Should also point out the service was stopped prior to copying files and all files chown'ed to have mysql as owner and then the service restarted prior to attempting to access the data.
To answer your question indirectly, there is some information here regarding setting up replication using a raw file copy. So I guess the answer is possibly yes, but it may depend.
http://dev.mysql.com/doc/refman/5.0/en/replication-howto-rawdata.html
Not wishing to add to your current pain, but were you relying on a backup that you have never tried / don't know how to restore?