Solved

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

Posted on 2013-05-28
5
3,026 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
5 Comments
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 166 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 25

Accepted Solution

by:
Tomas Helgi Johannsson earned 168 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 166 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Foreword This article was written many years ago, in the days when PHP supported the MySQL extension (http://php.net/manual/en/function.mysql-connect.php).  Today (http://php.net/manual/en/migration70.removed-exts-sapis.php) you would not use MySQL…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

679 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