Home  >  Article  >  Database  >  Detailed explanation of MySQL database source command_MsSql

Detailed explanation of MySQL database source command_MsSql

微波
微波Original
2017-06-28 15:40:5614385browse

This article mainly introduces the detailed explanation of MySQL database source command and related information about examples. Friends in need can refer to

MySQL database source Command details and examples

MySQL database source command, this command is a database import command. The usage of the source command is very simple. First, you need to enter the command line management interface of the MySQL database, then select the database to be imported, and execute the source command. As shown below.

MySql database source command


mysql> use test
 
Database changed
 
mysql> set names utf8;
 
Query OK, 0 rows affected (0.00 sec)
 
mysql> source C:/test.sql
 
Query OK, 0 rows affected (0.00 sec)
 
Query OK, 0 rows affected (0.33 sec)
 
Query OK, 0 rows affected (0.07 sec)
 
Query OK, 1 row affected (0.02 sec)
 
Query OK, 1 row affected (0.03 sec)
 
Query OK, 1 row affected (0.02 sec)
 
mysql> set names gbk;
 
Query OK, 0 rows affected (0.00 sec)


Tips:

1. In Windows, the file path should be replaced with "/" for the default path character "\", such as:


mysql> source C:/test.sql


2. Make sure the character encoding of the script file (.sql / .ddl) is utf8;

3. Before running the source command, execute the command: set names utf8;


mysql> set names utf8;
mysql> source C:/test.sql


4. Before running the source command If you need to view Chinese correctly on the command line, first execute the command: set names gbk; modify the command line window character encoding. As follows:


mysql> set names gbk;
 
mysql> select * from user;

The above is the detailed content of Detailed explanation of MySQL database source command_MsSql. 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