Home Linux ServerWeb Server Command to backup/import MySQL database on Linux server

Command to backup/import MySQL database on Linux server

by Thạch Phạm

In some cases, you need to back up the database and VPS you don’t use any control panel. Or you need to import the database, but the database is too large to a few hundred MB, this article will help you to backup and import the database on VPS quickly and simply.

1. BACKUP DATABASE

You perform the dump database with the following command

 mysqldump --opt -u dotr_dotrungquan -p dotr_dotrungquan > filebackupdatabase.sql

Note:

  • – u dotr_dotrungquan : database user
  • – p dotr_dotrungquan : database name
  • filebackupdatabase.sql : name of the backup file you want to save
  • –opt : mysqldump options

After running the above command, the system will ask for the database password, enter the correct password

2. IMPORT DATABASE

After you have completed the database creation and saved the database information, including user data, username and password, you move to the directory containing the database that has been uploaded to the VPS and run the following command

mysql -u dotr_import -p dotr_import < filebackupdatabase.sql

Note:

  • – u dotr_import : database user
  • – p dotr_import : database name
  • filebackupdatabase.sql : Name of the saved backup file (the backup file you want to restore)

  • Hotline 24/7: 028 730 24768 (Ext 0)
  • Ticket/Email: You use the email to register for the service and send it directly to: support@azdigi.com
Đánh giá

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign