Importing SQL File Into Your Database
From the list of files that you have on your new server, you will see your data.sql files that you dumped earlier. We will need to import that into your new database. You will need the new database name, database username and database password for this process. Here is the command to enter in the terminal.
mysql -u username -p database-name < data.sql
Enter your password next, you cannot see yourself typing the password so make sure you enter it correctly.
You can check your PhpMyAdmin to see if it looks right.
Alternative Way Of Checking MySQL
There is another way to check to see if your database imported correctly in terminal. Here are the steps to check. Enter this code.
After you enter the command you will see that you are in mysql. The terminal line will look like this “mysql>”. Once you see that enter in the following code.
MySQL will print out a list of databases that it has. Now you want to see that database that you imported your sql file into so use this command. You want to, of course, type the name of your database after the USE command.
You will get a message that states, “Database changed”. Now enter this command.
You will see a printout of all the tables in your database. If it looks like wordpress tables then you are done confirming that the database has been improted properly. Type the following command to exit MySQL.
Then MySQL will print the message “Bye”. On the next page we will edit the wp-config.php file.