How to quick Rename MySQL Database Name

Try this shell command.

for table in `mysql -u root -proot -s -N -e "use old_db_name;show tables from old_db_name;"`; do mysql -u root -proot -s -N -e  "use old_db_name;rename table old_db_name.$table to new_db_name.$table;"; done;

Enjoy.

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *