sql.gz數據備份與恢復


數據全備

mysqldump --skip-opt -h hostname -u username -ppassword databasename | gzip > sqlback.sql.gz

 數據恢復

gunzip < sqlback.sql.gz | mysql -uusername -ppassword databasename

最近在windows解壓使用source恢復數據會出現:ERROR 1231 (42000): Uariable 'table_name’ can't he set to the value of 'NULL'

恢復完成后看見有些數據出現了亂碼情況

看了網上很多說修改max_allowed_packet,好像修改了也沒啥用

最后,看了下還有utf8的字符串問題,下了gunzip.exe和gizp.exe2個包放在c盤C:\Windows\System32下,打開cmd執行

gunzip < D:\xxxx.sql.gz | mysql -h127.0.0.1 -uroot -proot -P33066  --default-character-set=utf8 databases

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM