of USES the command line to move the mysql database
- 2020-06-12 10:50:46
- OfStack
Export sql file
Using phpmyadmin to export your database to sql files at your original web service provider is a familiar step.
Upload the sql file
As mentioned earlier, we did not install ftp on the cloud host, how to upload?
Open the ftp client software, such as filezilla, and use the server IP and root and password. When connecting, you must use SFTP to connect to linux. Note that this method is not secure, but we do not have ftp here, and there is no better or faster way to upload local files to the server.
We upload database. sql to /tmp directory.
Connect to linux, log in to mysql
Connect to the cloud host using putty. The usage of putty is not described here.
Once connected, log in to mysql
>mysql -u root -p
>password:
Note that if you have previously set up other mysql users, you can choose the appropriate user to log in. You can learn about the mysql command line elsewhere.
Import the uploaded sql into the database
Follow these three steps to quickly import the sql file
mysql>use yourdatabasename;
mysql>set names utf8;
mysql>source /tmp/database.sql;
Then the screen will continue to roll, finally prompted import success.
Finally, remember to delete database.sql.