【刷題】麪筋-mysql-如何對數據庫進行備份

語法

  • 備份:

    • bin>mysqldump -u root -p 要備份的數據庫名>本地保存備份的路徑+文件名
  • 恢復:

    • bin>mysql -u root -p 要恢復的數據庫名<本地保存備份的路徑+文件名
  • 注:

    • 文件名後綴能夠是txt,也能夠是sql

示例

  • 備份:

    • 對數據庫進行備份處理時不用進行登陸:html

    • mysqldump -u root -p test >c:/test.sqlmysql

    • enter password : rootsql

    • 這樣就能夠對數據庫 test進行備份 到c盤的test,sql 文件裏
      數據庫

  • 對數據進行回覆

    • MySQL -u root -p test < c:/test.sql 3d

    • password root code

    • 注:恢復時須要建立一個空的數據庫,再次對數據庫進行查詢時 表格 就會出來

      htm

參考連接

END

相關文章
相關標籤/搜索