How To Import and Export Databases in MySQL or MariaDB
How To Import and Export Databases in MySQL or MariaDB
MySQL and MariaDB are popular relational database management systems used by developers and businesses alike. Here's a step-by-step guide on how to import and export databases in both MySQL and MariaDB.
Exporting a Database
- Open a command prompt or terminal window
- Type the following command to export the database:
mysqldump -u username -p database_name > backup.sql - Replace
usernamewith your database username anddatabase_namewith the name of the database you want to export - You will be prompted to enter your database password
- The exported database will be saved as a
.sqlfile namedbackup.sql
Importing a Database
- Open a command prompt or terminal window
- Type the following command to import the database:
mysql -u username -p database_name < backup.sql - Replace
usernamewith your database username anddatabase_namewith the name of the database you want to import - You will be prompted to enter your database password
- The database will be imported from the
.sqlfile namedbackup.sql
That's it! You've now learned how to import and export databases in MySQL and MariaDB.
Keywords: MySQL, MariaDB, database, import, export, command prompt, terminal window, mysqldump, mysql, backup.sql, username, password.
Комментарии
Отправить комментарий