maxieduncan

Monday, 7 June 2010

Copying databases with mysql

To copy the database use mysqldump:

mysqldump -u root <DATABASE_NAME> <DUMP_FILE>.sql;

To create the new database:

mysql
mysql> create database <NEW_DATABASE_NAME>;
mysql> use <NEW_DATABASE_NAME>;
mysql> source <DUMP_FILE>.sql;

2 comments:

  1. Got error: 1016: Can't open file: '...' (errno: 24) when using LOCK TABLES

    table_cache might be too small.

    Try --lock-tables=false on mysqldump.

    From: http://mysql.bigresource.com/Track/mysql-L5WFTgJm/

    ReplyDelete