How do I load a sql.gz file to my database? (importing)

后端 未结 7 1150
-上瘾入骨i
-上瘾入骨i 2021-02-05 01:34

is this right?

mysql -uroot -ppassword mydb < myfile.sql.gz
7条回答
  •  日久生厌
    2021-02-05 02:28

    For Generating dbName.sql.gz

    mysqldump -u  -p  | gzip > ~/mysqlBackup/dbName_`date +%Y%m%d%H%M`.sql.gz
    

    For Loading dbName.sql.gz

    zcat ~/mysqlBackup/<.SQL.GZ file> | mysql -u  -p 
    

提交回复
热议问题