Use MYSQL commands to directly Import and Export SQL files

Source: Internet
Author: User
Tags mysql commands

Most of the time, our data development will use a lot of development tools, such as powerdesigner, navicat, and so on. Although they are easy to use, they have to charge fees. pirated software is prohibited in the company, we are afraid of fines from various aspects, so we do not dare to install a cracked version on the company's machine. What should we do if we want to import or export SQL statements, although there are also free software such as mysql-workbench, it is difficult to use and complicated to operate. I think it is convenient to remember the password and IP address username, of course, it is actually very powerful.

Well, back to the truth, the simplest way is to directly use the mysql command to import and export SQL statements. Although there are a lot of online users, they don't feel very clear about the format of the description. It's hard to see what it is, so I'll write another article here.

1. Export the database to an SQL file in MYSQL

In fact, it is very simple, it is just a statement. First we open cmd, instead of entering the mysql command interface, directly press the Export Statement in the following format, and then enter the password:

Well, it may be a bit abstract. Let's take an example. Currently, I have a database bookinfodb in MYSQL. Now I want to export it and save it to disk D.

At this time, we will go to the d directory and we will see an additional bookinfodb. SQL file.

2. import data from the SQL file to MYSQL

1> first, we should enter the mysql command interface in cmd. The format is simple, just enter the password.

2> Create a database and then select the database to use

3> Import SQL files directly

Next we will output a large string of information such as Query OK.

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.