Overview
MySQL database import and export, there are two ways
1) pilot out SQL script, then import (import and export are divided into two kinds: 1. Command. 2. Tools. Here we only introduce commands).
2) Copy the database file directly (this method is not recommended).
First, MySQL database import
1. Existing database, you can use the MySQL command directly
Command format
Mysql-u User name-p password database name < SQL file path
Example: mysql-uroot-p12345678 Test </root/test.sql
2. Create a new data import
mysql-uroot-p12345678
mysql> CREATE DATABASE ABC; Delete database command: Drop DB ABC;
mysql> use ABC;
Mysql> Source/root/test.sql
Second, MySQL database export
· Use the mysqldump command (located in the Mysq/bin directory)
Command format
Mysqldump-u User name-p password database name > SQL file path
Example: mysqldump-uroot-p12345678 ABC >/root/abc.sql
Second, MySQL database name modification
This one has a command.
1. Command format
Rename database name to new database name
Note: This command is not supported for all versions of the database
2. Then there's another way: Close the MySQL service, go to the database directory, repair the directory name, and then start MySQL
Personal view: I still do not recommend modifying the database name directly, it is recommended to create a new database and import