MySQL Dump Database On Original Server
The first action we have to perform after we log in is to dump the MySQL database into a file that we can transfer. You will need 3 things from your WordPress database. You will find this information in the wp-config.php file.
- Database Name
- User Name
/** The name of the database for WordPress */ define( 'DB_NAME', 'database-name' ); /** MySQL database username */ define( 'DB_USER', 'database-user' ); /** MySQL database password */ define( 'DB_PASSWORD', 'database-password' );
When you logged into your terminal, you want to execute the following command to create a SQL file called data.sql.
mysqldump -u username -p database > data.sql
If you get the following error, then you need to use the –no-tablespaces tag.
mysqldump: Error: ‘Access denied; you need (at least one of) the PROCESS privilege(s) for this operation’ when trying to dump tablespaces
Here is how you do a mysldump with the notablespaces tag.
mysqldump --no-tablespaces -u database_name -p user_name > data.sql
Next, enter the password to the database. Note: you cannot see the password while to type it in.
You should now see data.sql in the file list.
Now, on the next page, we will zip all these files together recursively to transfer to the new server.