MySQL Import and Export SQL scripts
MySQL export SQL scripts
* It must be in D: \ ltsoft \ mysql4 \ bin> mysqldump-u root-P test> C: \ A. SQL
First, go to the BIND directory of the mysqlinstallation directory (you can see mysqldump.exe). Generally, MySQL is installed in c: \ Program by default. Files \ mysql \ MySQL Server 5.0
* You cannot enter the MySQL command.
MySQL Export and Import SQL scripts
1. Export an SQL script
Mysqldump-u username-P Database Name> storage location
Mysqldump-u root-P test> C: \ A. SQL
(The preceding Method for exporting SQL Scripts has been tested in person and succeeded !)
2. Import an SQL script
Mysql-u username-P database name <storage location
Mysqljump-u root-P test <c: \ A. SQL
Note: The test database must already exist.
Bytes
Instead of mysqldump for execution, the expected results were not obtained (expected results: the database Added tables and data according to the script ))
Use the following 4th methods to import SQL scripts to the database.
Use Cases for MySQL Export Import commands
1. Export the entire database
Mysqldump-u username-P Database Name> exported file name
Mysqldump-u wcnc-P smgp_rj_wcnc> wcnc. SQL
2. Export a table
Mysqldump-u user name-P database name Table Name> exported file name
Mysqldump-u wcnc-P smgp_rj_wcnc users> wcnc_users. SQL
3. Export a database structure
Mysqldump-u wcnc-p-d -- add-drop-Table smgp_apps_wcnc> D: wcnc_db. SQL
-D no data -- add-drop-table adds a drop table before each create statement.
4. Import the database (Tested successfully! Tables and data can be directly imported into the database from SQL scripts !)
Common source commands
Go to the MySQL Database Console,
For example, MySQL-u root-P
Mysql> Use Database
Then run the source command. The following parameter is the script file (for example,. SQL used here)
Mysql> source D: wcnc_db. SQL