mysql backup restore command line

The command line backup is a text file, specifying the file encoding utf8:

@set timestr=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%

@set filename=C:/db_bkp_%timestr%.sql
@C:\mysql_win32\bin\mysqldump.exe --default-character-set=utf8 --add-drop-table -uroot -p12345 dbname > %filename%

 

The command line restores data from the specified utf8 encoded sql file:

d:/mysql_win32/bin/mysql.exe -uroot -p12345 --default-character-set=utf8 dbname< d:/utf8.sql

 

Note,

If the sql file is too large, the import may fail. Record the configuration my.ini to set the import file size limit, for example, set the upper limit to 100M:

max_allowed_packet=100M

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326481744&siteId=291194637