Home > Database > Mysql Tutorial > How to import sql file into database

How to import sql file into database

清浅
Release: 2020-09-14 14:12:46
Original
66643 people have browsed it

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
Copy after login

After entering MySQL

MySQL>use DR;  
MySQL> source c:/DR.sql
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template