Home  >  Article  >  Database  >  How to import sql file into database

How to import sql file into database

清浅
清浅Original
2019-05-08 11:41:1666601browse

There are two ways to import sql files into the database. One is to use the cmd debugging environment to import the data in the sql file, and the other is to use the MysqlWorkbence debugging environment to import the data.

How to import sql file into database

There are two ways to import sql files into the database:

Method 1

Use the cmd debugging environment to import the data in the .sql file:

Win R key to open cmd input:

MySQL -u root -p

After entering MySQL

MySQL>use DR;  
MySQL> source c:/DR.sql

Pay attention to the above DR is a pre-created folder under the data directory of Mysql. DR.sql is the content of the database you downloaded. Note that DR.sql must be placed in the outermost directory of the disk, otherwise the data cannot be imported.

Method 2

Use Mysql Workbence debugging environment to import data

Open the Mysql Workbence software, select Data Import/Restore, and select Import from self-Contain File, then select the storage path of the DR.sql file to import data and the database name DR of Default Target Schema, and finally click Start Import.

Of course the file format of the database imported by cmd is different from the format of Mysql workbence, but they both have frm files.

The above is the detailed content of How to import sql file into database. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn