MySQL export database table statement and data

MySQL command line export database:
1. Enter the bin folder in the MySQL directory : cd MySQL to the bin folder directory
As I entered the command line: cd C:\Program Files\MySQL\MySQL Server 4.1\bin
(or directly add this directory to the Windows environment variable path)

2. Export the database: mysqldump -u username -p database name > exported file name
For example, the command line I entered: mysqldump -u root -p news > d:\news.sql (after entering, it will let you enter the password to enter MySQL)
(If you export a single table, enter the table name after the database name)

3. You will see that the file news.sql is automatically generated under   the bin file
Import the database from the command line:

1. Move the .sql file to be imported to the bin file, this path is more convenient
2, the same as the first step of the above export
3. Enter MySQL: mysql -u username -p
For example, the command line I entered: mysql -u root -p (after entering the same, you will be asked to enter the MySQL password)
4. Create a new database you want to build in MySQL-Front, which is an empty database at this time, such as creating a new target database named news
5. Enter: mysql>use target database name
Such as the command line I entered: mysql>use news;
6. Import file: mysql>source imported file name;
Such as the command line I entered: mysql>source d:\ news.sql;

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326617083&siteId=291194637