News
Seven days of Black Friday madness — great deal from Serverspace!
Serverspace Black Friday
VB
November 21, 2022
Updated June 7, 2023

How to export and import MySQL databases

Databases

What is DB export/import purposes

You may need to export or import your database upon regular backup operations, moving project to another server, disaster recovery operations etc.

Methods for database export

Actual server control panels may provide possibilities to export and import database data. E.g. in aapanel you click to Databases link, then create database backup and download it;

pic1

pic2

pic3

If your server has PHPMyadmin, you can use it for DB-export. Just login to PHPMyadmin as user with permissions for "manage" database, click to the DB-name, then Export tab and Go button;

pic4

But even if no any GUI-features possible, you can export database via SSH-console. Authorize on the server, then run:

mysqldump db_name > /path/db_name.sql

pic5

How to import database

To import database via server management panel you can click to Databases link, then Import > Upload from local, select dump file on your computer and press to Import;

pic6

pic7

Also, you can import dump via PHPMyadmin. Login, click to the database name, then Import, choose dump file and click to Go button:

pic8

And of course, you can import DB dump via SSH. Just run:

mysql -udb_username -p dbname < /path/to/dump.sql

Then type your password.

pic9

 

Conclusion

In this article I explained why you could need to save or restore your database and how to do this in a few ways.

Vote:
4 out of 5
Аverage rating : 4.8
Rated by: 4
1101 CT Amsterdam The Netherlands, Herikerbergweg 292
+31 20 262-58-98
700 300
ITGLOBAL.COM NL
700 300
We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.