Warning: include(/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php): failed to open stream: No such file or directory in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: include(/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php): failed to open stream: No such file or directory in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: include(): Failed opening '/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php' for inclusion (include_path='.:/opt/cpanel/ea-php70/root/usr/share/pear') in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24
透過command來搬mysql資料庫 – unethost無限空間虛擬主機 技術分享部落格

透過command來搬mysql資料庫

獨立主機的客戶,從別家搬過來,mysql的資料庫總是搬不好。透過phpmyadmin也是搞不定。其實phpmyadmin會有error也是很正常的事。phpmyadmin是跑在http protocol之上的。http 的post如果有時間限制或是php的執行時間有限制,就很容易timout。

沒有辦法,只好直接下command來搬。

<<匯出>>
mysqldump -u “your_username” -p –lock-tables –databases DB1 [DB2 DB3…] > your_database_dump.sql

<<匯入>>
mysql -u “your username” -p “your_database” < database_dump.sql

如果匯出的時候,有using –all-databases 選項,可以使用:
mysql -u “your_username” -p < your_database_dump.sql   來匯入,比較簡單。