To import and/or export a MySQL or MariaDB database, you will need:

  • Access to the Linux server terminal
  • The database name, user, and password of it

Exporting the Database

mysqldump is a powerful tool which is used to export the MySQL or maria database.

Export the database using the following command :

username -pdatabase_name > filename.sql

  • username is the user assigned to the database
  • database_name is the name of the database that will be exported
  • filename.sql is the file in the current directory that the output will be saved to

Importing the Database

You can import any SQL or compressed database backup file (.zip) by using the following command :

mysql -u username -p database_name < filename.sql

The command will not print any output. If your backup file is large, you need to wait a bit for it to execute all the queries of the file. Stay patient and wait for the command to finish.

 

Ha estat útil la resposta? 0 Els usuaris han Trobat Això Útil (0 Vots)