[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 9211
  • Last Modified:

Attach / Detach a database possible in mysql??

Hello

I don't have much experience in mysql but i was wondering what would be the easiest way to move our current mysql database to another server. In MS-SQL Server there is a feature to attach/detach a database so i was looking at something like that. Of course we can export it to .sql file and import it back but this database is pretty big so that will not be possible (or last option).

thanks everyone!
0
MichaelPro
Asked:
MichaelPro
2 Solutions
 
Yuval_ShohatCommented:
a good place to get some background would be"
http://www.databasejournal.com/features/mysql/article.php/3421751

but beside that,
i dont know if choosing a .sql would be my first pick...
read here:
http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html
http://dev.mysql.com/doc/refman/5.0/en/backup.html

-=Yuval=-
0
 
NovaDenizenCommented:
What kind of table engine do you use, MyISAM or InnoDB?  With MyISAM its as simple as just copying all the .frm, .MYI, and .MYD files from the database directory.  With InnoDB it's not so simple, and probably best to use mysqldump.

You can compress the .sql on the fly to reduce its size.
mysqldump MyDatabase | gzip -c > MyDatabase.sql.gz

To restore (after you have done "CREATE DATABASE MyNewDatabase")
gzcat MyDatabase.sql.gz | mysql MyNewDatabase
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now