Go Premium for a chance to win a PS4. Enter to Win


Import mysql database without a dump file

Posted on 2011-02-15
Medium Priority
Last Modified: 2012-05-11
We have an old web server that was decommissioned and has been gathering dust. It had a mysql database on it which we now want access to. The server will not run but I have the entire mysql directory.

I installed mysql on a test server and would like to import the database but I don't know how. How would I go about doing that. I've imported from dump files before but I don't know how to do it with the raw files.
Question by:AJNS
  • 4
  • 3
  • 2

Expert Comment

ID: 34898551
You should be able to copy the data directory from one server to another and then start the new server and the files will simply be read. Does this work for you?

Author Comment

ID: 34898562
I tried that but it gave me errors that files couldn't be found. I checked the .ini file it was calling and it points to a file structure from the old server.

I tired to recreate it but it always gave me the error. That's why I was hoping there was some way to import.

Accepted Solution

coolbloke1324 earned 500 total points
ID: 34898641
You shouldn't copy the ini file, only the files in the data directory.

The INI file should be located one level below the data directory.

I'd clean install a new MySQL, see where it's data directory is and then only copy your old data directory to the new one, not including any ini files, bin files etc. Only the data directory.

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.


Author Comment

ID: 34898674
ok, i'll try that right now.

Expert Comment

ID: 34898970
I would also run the mysql_update utility against it to update the tables to the
proper structure associated with the new MySQL.

Expert Comment

ID: 34899164
I think wolfgang_93 has an excellent point... worth doing that too. Did those steps work for you?

Author Comment

ID: 34900284
I did the above and the sql service started. I am using SQL Manager 2010 to access it and I can bring up one of the databases but not the others.

In my data directory there are several folders, one called test and several others that I need, each one being a database. When I register the databases in SQL Manager it only finds the "test" database, not the others. I'm not sure what I need to do to access them.

I can type the alias in for the database and it creates a shortcut but there is not data there, it's not actually seeing it.

Assisted Solution

wolfgang_93 earned 500 total points
ID: 34901016
One thing I should have also suggested is to issue this command:
   flush tables;

I'm not familiar with SQL Manager 2010 as I use the "mysql" utility itself on the
server to do database mangement.

I found an item about SQL Manager 2010 having an option to "register" a
database -- which may be what you need to do. Here is info on it:
Registering Databases

In order to register a single database in SQL Manager 2010 for MySQL:

    * select the Database | Register Database... main menu item or use the corresponding Register Database btnRegisterDB toolbar button


    * right-click any database alias and select the Register Database... context menu item in the DB Explorer tree;
    * set all the necessary options using Register Database wizard which guides you through the entire process of database registration.


Author Comment

ID: 34907464
wolfgang 93 - I was using the register database but it wasn't working. It wouldn't find the databases so after reading your post I looked up using the mysql utility and easily used it at the command line to import the databases. I was then able to register and use them in sql manager.

coolbloke1324 - your suggestion for copying just the data folder was right on the mark.

Thanks for the help

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question