Dump db to your localhost (windows)
notice : mysql tool navicat is forbidden because using this tool is prone to delete data by accident. ( This stupid thing happened indeed )
1. Download MySql GUI ( http://dev.mysql.com/downloads/gui-tools/5.0.html )
2. Open MySql Migration
....
notice : mysql tool navicat is forbidden because using this tool is prone to delete data by accident. ( This stupid thing happened indeed )
1. Download MySql GUI ( http://dev.mysql.com/downloads/gui-tools/5.0.html )
2. Open MySql Migration
....
Dump MySQL db ( by MySQLdump)
使用--skip-create-options避免使用MySQL table specific option,避開新舊版本相容性
--quick 抓一個row就存一次,避免memory不夠裝滿整個table
--skip-lock-tables 不lock table
倒整個db
mysqldump --skip-create-options --quick --skip-lock-tables -u php -p -C -h 10.15.2.2 -B users soulmatch vhost14168 portrait gdaa arc smartmatrix adsmart > all_db.sql
我用上面的方法,某些table的primary key會沒有autoincrement,會出錯(不是全部,只有部份會沒有autoincrement)
可用手動在MySQL GUI query browser中複製出create table statement,再貼成一個檔案
只倒table data(一次一個db比較ok, 大小不會太大)
mysqldump -u 帳號 -p密碼 -h 10.15.2.21 --skip-opt --no-create-db --no-create-info --disable-keys --extended-insert --set-charset --skip-add-locks --skip-quick --databases users > d:\data_users.sql
Restore dumped db
mysql -u root -p < all_db.sqlmysql -u root -p dbname < table.sql
SQL query
有使用到中文時,要設定使用utf-8
mysql --default-character-set=utf8
PS. MySQL query browser 1.2.17不支援中文(或utf-8)
No comments:
Post a Comment