Tuesday, July 24, 2007

How to take Mysql backup/ export an existing database to a new one

Normally its better to go for shortest way possible.....

Backing up a database

  • Go to /usr/local/mysql/bin/ (This is where normally mysqldump file will be installed- recomended or /usr/bin/ )
  • ./mysqldump -u[user] -p[password] -d[databasename] >> [Output_filename.sql]


Exporting...
This is a common need with database users or administrators simple way is restore a dump to a new database :)
  • Copy the dump file to /usr/local/mysql/bin/
  • ./mysql -u [user] -p [password] -h [host IP] -D [database name] < [filename.sql]

No comments: