Use the wget and source commands in CentOS to import SQL files

Source: Internet
Author: User
Tags centos create database

In Alibaba Cloud CentOS, you need to import an SQL file to the database, use wget to download the SQL file, and use the source command to import the SQL file.

① First, log on to the database:

[Root @ iZ94r80gdghZ tanteng. me] # mysql-u root-p
Enter password:


② Use the create database command to create a database:

MariaDB [(none)]> create database testxx;
Query OK, 1 row affected (0.00 sec)

③ Because the SQL file is online, you must first use the wget command to download it to the server. Log out of the database first. For example, to download an SQL file from the root directory of the website, run the wget command:

Wget ftp: // vh587135: z65t4i6t@cd551.gotoip.net/_ bak _/mysql/s587135db0_20160319231127. SQL

④ Go to the database and switch the database to the newly created database:

Use testxx;

⑤ Use the source command to import the SQL file:

Source/usr/share/nginx/html/tanteng. me/s587135db0_20160319231127. SQL

In this way, the data is successfully imported to the database through the SQL file. Then, delete the SQL file.

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.