How to import SQL files in linux (use command line to transfer mysql database) bitsCN.com
Export SQL files
Use phpmyadmin to export the database as an SQL file at your original website service provider.
Upload SQL files
As mentioned above, we have not installed ftp on the cloud host. how can we upload it?
Open the ftp client software, such as filezilla, and use the server IP address and root password. during connection, you must use SFTP to connect to linux. Note: This method is not safe, but we do not have ftp here. if you want to upload local files to the server, there is no better and faster way.
Upload database. SQL to the/tmp directory.
Connect to linux and log on to mysql
Use putty to connect to the VM instance. The usage of putty is not described here.
After the connection, log on to mysql
> Mysql-u root-p
> Password:
Note: If you have created another mysql user, you can select the appropriate user to log on. You can learn about mysql command lines elsewhere.
Import the uploaded SQL into the database
Follow the three steps below to quickly import the SQL file
Mysql> use yourdatabasename;
Mysql> set names utf8;
Mysql> source/tmp/database. SQL;
Then, the screen will be rolled continuously, and the prompt is displayed, indicating that the import is successful.
Finally, delete database. SQL.
BitsCN.com