snippetsqlModerate
How do I open a MySQL Database Dump?
Viewed 0 times
dumpopendatabasemysqlhow
Problem
I work for a doctor's office, and we are in the process of switching EMR systems. The previous system has provided a physical 'dump' of the database. I however, don't know how to open this database and view the contents therein. The file is 1.2 gb with less then 1000 lines of SQL commands so I assume that all of the data is there. Here's what I've tried thus far:
What are some steps to properly opening and obtaining the data found within a MySQL data dump?
I'm VERY new to the whole database management so if I've missed any details feel free to prompt.
- Opened in a text reader: All it shows is a bunch of SQL commands to create the database tables
- Installed MySQL Workbench and tried to create a "EER Model From SQL Script": This just creates the database structure.
- Using MySQL Workbench/Setup a 'localhost' server: Tried a 'import' of the .sql file onto the newly created 'server' but it doesn't work and spits out an error
What are some steps to properly opening and obtaining the data found within a MySQL data dump?
I'm VERY new to the whole database management so if I've missed any details feel free to prompt.
Solution
Although there are a number of tools out there, I prefer the command line for tasks such as this. Better performance, and just simpler.
Make sure you're logged into the mysql client:
The first step is to create a database in mysql that you want the data in:
Then you need to open--or use--that new database, which is empty:
All that's left is to do the import:
If all goes well, you'll see a bunch of output about "Query successful, N rows affected" and so on.
Make sure you're logged into the mysql client:
mysql -u -pThe first step is to create a database in mysql that you want the data in:
CREATE DATABASE ;Then you need to open--or use--that new database, which is empty:
USE ;All that's left is to do the import:
\. /path/to/file (or if in Windows, \. C:\PATH\TO\FILE)If all goes well, you'll see a bunch of output about "Query successful, N rows affected" and so on.
Code Snippets
mysql -u <username> -pCREATE DATABASE <database name>;USE <database name>;\. /path/to/file (or if in Windows, \. C:\PATH\TO\FILE)Context
StackExchange Database Administrators Q#3822, answer score: 10
Revisions (0)
No revisions yet.