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

x
?
Solved

MySQL - How do I detach and attach a database in MySQL?

Posted on 2013-05-28
5
Medium Priority
?
4,289 Views
Last Modified: 2015-05-07
I created a database on 1 computer and wanted to copy the database to another computer.

How can I do that using MySQL Server?

Ideally I would like to use a utility similar to Microsoft SQL management studio. Is there such a utility for MySQL?
0
Comment
Question by:dan9591
3 Comments
 
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 664 total points
ID: 39203116
You can also use MySQL Workbench which is free: http://www.mysql.com/products/workbench/   But MySQL doesn't work the same as MS SQL.  You can 'dump' a database from one and import it into the other but it doesn't 'detach' and 'attach'.  See 'mysqldump': http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html
0
 
LVL 26

Accepted Solution

by:
Tomas Helgi Johannsson earned 672 total points
ID: 39204035
Hi!

To transfer a database between computers it is best to use mysqldump from a cmd line to dump the database and it's contents to a file and then import it to the other computer.
It is a easy and useful tool and available as part of MySQL core utilities.

backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

restore:# mysql -u root -p[root_password] [database_name] < dumpfilename.sql

See the manual for further info
http://dev.mysql.com/doc/refman/5.6/en/mysqldump.html

Regards,
    Tomas Helgi
0
 

Assisted Solution

by:ppetpulliwar
ppetpulliwar earned 664 total points
ID: 39210041
Hi!

To transfer a database between computers it is best to use phpmyadmin to install in both computers and export database file in .sql ext. from computer 1 and import it to computer 2 using phpmyadmin it is very easy and gui based tool its require only iis or apache service running in ur pc or server.

then u synchronize the database in u r 2 computers and u also creating replication between tow same database
configure replication follow this link : http://santoshkumarsarkar.blogspot.com/2012/06/mysql-replication-with-phpmyadmin.html

Regards,
paresh petpulliwar
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month8 days, 23 hours left to enroll

876 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