MySQL database source command details and examples, mysqlsource
MySQL database source command details and examples
MySQL database source command, which is a Database Import command. The usage of the source command is very simple. First you need to go to the command line management interface of the MySQL database, then select the database to be imported, and execute the source command. As shown in.
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)
Tip:
1. In Windows, replace "/" with the default path character "\", for example:
mysql> source C:/test.sql
2. Ensure that the character encoding of the script file (. SQL/. ddl) is utf8;
3. Run the set names utf8 command before running the source command;
mysql> set names utf8;mysql> source C:/test.sql
4. After running the source command, if you need to view Chinese characters in the command line correctly, run the command: set names gbk; modify the character encoding of the command line window. As follows:
mysql> set names gbk; mysql> select * from user;
Thank you for reading this article. I hope it will help you. Thank you for your support for this site!