Manual Import Export MariaDB / MySQL Database

Issues: CentOS 7.x server running an instance of cPanel / WHM. There is an issue with the UI that interferes with import and export of databases, particularly when they are several megabytes in size. Using the UI, import, export is painfully slow.

Solution: Access SSH, and use mysqldump to move databases.

To export one specific table (for example):

mysqldump -u database_user -p database_name table_name > file_name.sql

If you are accessing as root, each database dump file will reside in the root directory.

Naturally, enter the database user password (for that specific database) when prompted.

To export the whole database:

mysqldump -u database_user -p database_name > file_name.sql

To import the whole database:

mysql -u database_user -p database_name < file_name.sql

2 thoughts on “Manual Import Export MariaDB / MySQL Database”

  1. This allows also for super fast moving of data to another database. Just remember to manually edit the database, find the statement (near the beginning):

    Database: `database_name`

    and change it to the name of the new database – Then import into the new database 😉

    Also, if doing this for a WordPress installation, don’t forget to update wp-config.php to point to the new database.

    Reply

Leave a comment

BlogLogistics