how to restore particular database from .sql file - mysql

I did mysqldump for --all-databases and after some software updation on my machine the one database has deleted. so, How to restore that particular database form .sql file?
.sql file contain mysqump for all database.
pleased suggest something

When I've done this in the past I've used Workbench.
The SQL should contain the code to re-create the schemas and tables, along with the data.

Related

I Want to use a mysql database from a backup of a non-working server on a new computer

My database is from a backup of the non-working server.
My database is the teachercenter folder that was on the server, and contains files for each table name with the extension *.frm.
I copied the database from:
C:\Users\xxx\Downloads\wamp-saved\wamp\bin\mysql\mysql5.1.36\data\
And pasted that folder on my computer here:
C:\wamp\bin\mysql\mysql5.6.17\data
I realize the the two mysql's were different versions, but I'm just trying to use the database files.
When I start up PHPMyAdmin on the new computer, it shows the teachercenter database in the list of databases.
Also, if I click the plus next to the teachercenter database, I can see a list of my database tables!
But if I click on teachercenter database itself, I get error:
No tables found in database.
How do I get mysql to recognize and let me operate (PHPMyAdmin) on the teachercenter database on the new computer?
I tried to start/use wampmanager.exe, but I don't see it running to use it's menus.
THE PROBLEM IS SOLVED:
At: stackoverflow.com/questions/10934745/… a simple answer to my probelem is given, as follows: "Yes this is possible. It is not enough you just copy the .frm files to the to the database folder but you also need to copy the ib_logfiles and ibdata file into your data folder." I copied the ib_logfiles and ibdata file into my data folder, and Voila! PHPMyAdmin was completely happy with the database and its tables and I could do SQL exports of table records.
Summary: To make use of a MySQL database of *.frm files that your MySQL doesn't understand, simply copy the ib_logfiles and ibdata file from whereever you got the .frm files from, and put these two files in the data folder next to the database you want to use. Once you do that, the MySQL database engine will recognize your database, and you can all PHPMyAdmin operations on your fully operational database.
Because you can't be sure that the MyISAM storage format backwards compatible, your safest option is to install MySql 5.1.36, use mysqldump to export your entire database to plain SQL, install MySql 5.6.17 and then import your data using SQL.
Also, this probably gives better results because your indexes are rebuild.

mysqldump.exe - how to have database renamed in the dump file

I'm writing a simple utility of merging few database dump files into a single one. I have a temporary database (lets name it 'db_temporary') and have to export it into the dump but in the dump file it should be named 'db_final'. Can I do this using 'mysqldump.exe'? This seems like a trivial task but I can't find any clue in the 'mysqldump' documentation here: https://dev.mysql.com/doc/refman/4.1/en/mysqldump.html
Big thanks to any help.
The Dump does not contain the database name, the dump only contains the tables and data from the database youve dumped. So yes, you could import the resulting SQL code in any Database you wish, just create a database and import the SQL code into that.
At least if you use it this form:
mysqldump.exe -u USERNAME -p database > database_dump.sql

restore specific database from mysql full .sql backup

I have a full back up from my all mysql databases, the problem is that my backup contain default mysql, performance_schema and information_schema databases that prevent me from restoring my backup.
the question is how i cant remove this default databases from my full backup?
i try to edit .sql backup file and delete create and insert for this database, but its make some problem on miss deleting injections.
is there a visual software that i open my .sql file with that and it show me a databases and the tables and i select some database to delet them ..?????!!!
please help me, my databases are very important ...
*I want something to virtualize my databases and i delete unwanted database from it and save as the result *
What about doing the following steps:
rename default databases in your .sql files
restore your backup
delete restored renamed databases

Possible to patch a mysql sql file without using phpmyadmin?

If I have a cms, shopping cart, or some db based web script and lets say it has a database with like 50 tables
If I have a .sql file (call it patch.sql) that has a few ALTER commands and some UPDATE commands, I can goto phpmyadmin, import the patch.sql file and it will "apply" the changes to my db.
But lets say I export my db to a mydb.sql file first
Is there a way to "apply" the changes from "patch.sql" to "mydb.sql" without using a database?
I figured some command line like
mysql.exe merge patch.sql mydb.sql
or something but I didn't see anything like that.
Is phpmyadmin with a database the only way?
If your goal is to be able to later reimport mydb.sql and get the patched version of the database, then no, there are no tools to do that. patch.sql may has altered the structure of the database as well as the data itself based on your description. What you should do is apply the patch to your database, then export your db to a new .sql file.

Backup Mysql Databases

I wanna reinstall windows on my PC i wanna backup my Databases in MySQL. I have around 30 plus databases. is there an easy way to back up the content and restore it later ?
You can use mysqldump -A to do generate sql dumps for all databases.
Reference: http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html
Alternatively, you can also just copy the acutal data directory.
Edit: apologies for not being specific, as others have noted this will work only ISAM. For innodb, you'll need to backup using mysqldump or another utility such as phpMyAdmin.
Use mysqldump to create a database dump of each database. You can later easily recreate the databases from these dumps by running them through mysql. This would be the most generic answer, knowing nothing more of your set-up.
If your databases contains MyISAM tables, then you could just copy the files. Otherwise (using INNODB) this doesn't work.
I assum you don't have the binary log activated, you should use mysqldump.
Take a look at: http://dev.mysql.com/doc/refman/5.1/en/backup-methods.html
You could try with PHPMyADMIN if you don't feel confortable with mysqldump.
go to phpmyadmin and export all the database.. After installing wamp in ur new pc.. go to import and import the files you've exported previously..
Have you given the GUI tools a try?
http://dev.mysql.com/downloads/gui-tools/5.0.html
Have a look at the "Backup" option in the MySQL Administrator. The "Restore" option might also be helpful after the backup is done. :-)
Allows you to backup a single db or all db's at once.
You can use SQLyog MySQL GUI to backup your database. It has scheduled backup(you can export data into a single file or as multiple files) and backup as SQL dump(The dump will contain SQL statements to create the table and/or populate the table) to take backup and can restore those .SQL files using Execute SQL script tool.
try the tool here.