From: http://blog.csdn.net/xiaoyu411502/article/details/5319232
First, use the mysqldump command only if you enter the bin directory under the MySQL installation directory in cmd.
My MySQL is installed on the E: disk. Therefore, first go to the bin directory:
E:/program files/MySQL Server 5.0/bin>
Then, you can use this command.
1. Export the entire database
Mysqldump-u username-P Database Name> storage location
For example:
Mysqldump-u root-P project> C:/a. SQL
(The exported project database has been tested in person and is successfully exported !)
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, successful !)
Export only the table structure without the data in the table:
Mysqldump-D-u root-P project position> C:/a. SQL
(Test, successful !)
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
Common source commands
Go to the MySQL Database Console,
D:/program files/MySQL Server 5.1/bin> mysql-u root-P
D:/program files/MySQL Server 5.1/bin> mysql> Use 'database'
Then run the source command. The following parameter is the script file (for example,. SQL used here)
D:/program files/MySQL Server 5.1/bin> mysql> source D: wcnc_db. SQL
5. Remotely export the database
The command is as follows:
Mysqldump-H 192.168.11.210-u root-P test> C:/test. SQL
Export the first 100 data records of a table
Local: mysqldump-u root-P password "-W 1 limit 100" microlens_dev> microlens. SQL
Remote: mysqldump-h192.168.135.200-u root-P "-W 1 limit 100" microlens_dev> microlens. SQL
From: http://blog.csdn.net/xiaoyu411502/article/details/5319232
First, use the mysqldump command only if you enter the bin directory under the MySQL installation directory in cmd.
My MySQL is installed on the E: disk. Therefore, first go to the bin directory:
E:/program files/MySQL Server 5.0/bin>
Then, you can use this command.
1. Export the entire database
Mysqldump-u username-P Database Name> storage location
For example:
Mysqldump-u root-P project> C:/a. SQL
(The exported project database has been tested in person and is successfully exported !)
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, successful !)
Export only the table structure without the data in the table:
Mysqldump-D-u root-P project position> C:/a. SQL
(Test, successful !)
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
Common source commands
Go to the MySQL Database Console,
D:/program files/MySQL Server 5.1/bin> mysql-u root-P
D:/program files/MySQL Server 5.1/bin> mysql> Use 'database'
Then run the source command. The following parameter is the script file (for example,. SQL used here)
D:/program files/MySQL Server 5.1/bin> mysql> source D: wcnc_db. SQL
5. Remotely export the database
The command is as follows:
Mysqldump-H 192.168.11.210-u root-P test> C:/test. SQL
Export the first 100 data records of a table
Local: mysqldump-u root-P password "-W 1 limit 100" microlens_dev> microlens. SQL
Remote: mysqldump-h192.168.135.200-u root-P "-W 1 limit 100" microlens_dev> microlens. SQL