First, the mysqldump command is used only if it is entered in the Bin directory under the MySQL installation directory in cmd.
My MySQL is installed on the e: disk, so first go to the bin directory:
E:/program Files/mysql/mysql Server 5.0/bin>
Then, you can use the command.
1. Export the entire database
Mysqldump-u user name-p database name > storage location
Like what:
Mysqldump-u Root-p Project > C:/a.sql
(Exporting the Project database has been tested, successfully!) )
2. Export the structure of a table with the data in the table
Mysqldump-u user name-P database name Table name > exported file name
Mysqldump-u root-p Project Position > C:/a.sql
(Test, Success!) )
Only the table structure is exported, with no data in the table:
mysqldump-d-u root-p Project position > C:/a.sql
(Test, Success!) )
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 add a drop table before each CREATE statement
4. Import the database
Common source Commands
Go to MySQL Database console,
D:/program files/mysql/mysql Server 5.1/bin > Mysql-u root-p
D:/program files/mysql/mysql Server 5.1/bin > Mysql>use ' database '
Then use the source command, followed by the script file (for example, the. SQL used here)
D:/program files/mysql/mysql Server 5.1/bin > Mysql>source d:wcnc_db.sql
5. Remote Export Database
The command is as follows:
Mysqldump-h 192.168.11.210-u root-p Test>c:/test.sql
Go MySQL import and export SQL scripts