How do I migrate a mysql database to linode
I have a few mysql databases that require migration to linode. These databases are on my local machine. I have installed mysql to my linode and have checked for answers in the q&a database. What is the correct method to do this ?
I'd be happy to give you some steps to use to get your local MySQL database onto your Linode! I've outlines the steps below, and provided links for additional resources.
1. Backup MySQL database on local computer
First, you'll need to backup your local computer's database using a MySQL dump.
mysqldump -u [username] -p [databaseName] > [filename]-$(date +%F).sql
2. File Transfer
You can then copy it to your Linode using something like the scp command.
scp [database name].sql [username]@[servername]:path/to/database/
3. Import the database
Next, you will need to import the dump to the actual database. This can be done using the command below.
mysql -u [username] -p dbname < dbexport.sql
Possible error messages:
ERROR 1049: Unknown database 'username_database'
You may receive the above error message if the databases for this user does not already exist on your Linode. This Community site post can walk you through the steps of how to do this, if you need a refresher.