How to import SQL files in Linux share (use command line to transfer Mysql database) _mysql

Source: Internet
Author: User
Tags ftp client mysql command line

Due to exporting SQL files

In your original website to use phpMyAdmin to export the database as a SQL file, this step everyone will, do not repeat.

Uploading SQL files

Said earlier, we did not install FTP on the cloud host, how to upload it?

Open the FTP client software, such as FileZilla, use the server IP and root and password, the connection must use the SFTP way to connect, so as to connect to Linux. Note that this method is unsafe, but we do not have FTP here, if you want to upload local files to the server, there is no better and faster way.

We uploaded the Database.sql to the/tmp directory.

Connect to Linux, login to MySQL

Connect to the cloud host using putty. Putty the use of the method here is not introduced.

After connection, login to MySQL

Copy Code code as follows:

>mysql-u root-p
>password:

Note that if you have previously established other MySQL users, you can select the appropriate user login. On the MySQL command line, you can learn from other places.

Import the uploaded SQL into the database

Follow the three steps below to quickly import this SQL file

Copy Code code as follows:

Mysql>use YourDatabaseName;
Mysql>set names UTF8;
mysql>source/tmp/database.sql;

Then the screen will continue to roll, and finally prompted the success of the import.

Finally, remember to delete the Database.sql.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.