Method sharing for importing SQL files in Linux (using the command line to transfer MySQL database)

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

Because the SQL file is exported

In your original website service provider to use phpMyAdmin Export database as SQL file, this step everybody, do not repeat.

Uploading SQL files

Previously said, we do not install FTP on the cloud host, how to upload it?

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

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

Connect to Linux and log in to MySQL

Connect to the cloud host using putty. How to use putty is not introduced here.

After connecting, log in to MySQL

Copy the Code code as follows:
>mysql-u root-p
>password:


Note that if you have previously established a different MySQL user, you can choose the appropriate user to log in. For MySQL command line, you can learn in other places.

Import the uploaded SQL into the database

Follow the three steps below to quickly import this SQL file

Copy the Code code as follows:
Mysql>use YourDatabaseName;
Mysql>set names UTF8;
mysql>source/tmp/database.sql;

Then the screen will continue to roll, the last prompt to import success.

Finally, remember to delete the Database.sql.

Method sharing for importing SQL files in Linux (using the command line to transfer MySQL database)

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.