Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Attaching an existing database with MySQL

Tags:

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?

like image 335
Martin Robins Avatar asked Dec 09 '12 16:12

Martin Robins


People also ask

How do I join an existing database in MySQL?

To access a specific database, type the following command at the mysql> prompt, replacing dbname with the name of the database that you want to access: Copy use dbname; Make sure you do not forget the semicolon at the end of the statement. After you access a database, you can run SQL queries, list tables, and so on.

How do I add a database to MySQL?

Importing a database from a fileFill in the fields with the connection information. Once connected to the database go to Data Import/Restore. Choose the option Import from Self-Contained File and select the file. Choose the destination database in Default Schema to be Imported To and then click on Start Import.


1 Answers

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.

like image 117
Martin Robins Avatar answered Oct 06 '22 00:10

Martin Robins