ผู้เขียน หัวข้อ: How to rename mysql database  (อ่าน 3554 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

ออฟไลน์ udomchok

  • Hero Member
  • *****
  • กระทู้: 8,349
  • Respect: +589
    • ดูรายละเอียด
    • ร.พ.สมเด็จพระสังฆราช องค์ที่ 17
How to rename mysql database
« เมื่อ: กุมภาพันธ์ 09, 2010, 08:59:07 AM »
0
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
ทำด้วยหัวใจร.พ.สมเด็จพระสังฆราช องค์ที่ 17 อ.สองพี่น้อง จ.สุพรรณบุรี
อบรมโดย BMS Team เมื่อ พ.ย. 49 ขึ้นระบบห้องบัตรเมื่อ X'Mas 2007
2008 : X-Ray กายภาพบำบัด แพทย์แผนไทย กิจกรรมบำบัด OPD ตา
2009 : ทันตกรรม ห้องตรวจตา OPD (พยาบาลและห้องตรวจแพทย์บางห้อง)