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.