BMS-HOSxP Community

HOSxP => MySQL => ข้อความที่เริ่มโดย: udomchok ที่ กุมภาพันธ์ 09, 2010, 08:59:07 AM

หัวข้อ: How to rename mysql database
เริ่มหัวข้อโดย: udomchok ที่ กุมภาพันธ์ 09, 2010, 08:59:07 AM
mysql -p
<enter password>
create database new_database;
quit


mysqldump old_database -p | mysql -D new_database -p
<enter password>

It'll dump out the old database to STDOUT, pipe this to a second MySQL process and insert the dumped data (and schema) to the new DB.

You'll have to manually DROP the old DB and change the permissions on the new DB, but at least you have the data and schema.

I find this very useful for creating 'live' backups of databases.

ได้มาจาก http://www.delphifaq.com/faq/databases/mysql/f574.shtml