mysql -uroot -p123456 --default-character-set=utf8 test123
Export the entire database
mysqldump -uroot -p123456 test123> test123.sql
Export database single table
mysqldump -uroot -p123456 test123log> test123_log.sql
Export database table structure
mysqldump -uroot -p123456 -d --add-drop-table test123> test123.sql
-d Export empty table
--add-drop-table 每个数据表创建之前添加drop数据表语句
When mysqldump is exported from the command line, if you enter a password, the following warning message will be prompted (it has been executed successfully, but the warning message will be prompted)
Warning: Using a password on the command line interface can be insecure.
3.1. Repair method
When exporting from the command line, manually enter the password
In /etc/mysql/my Append
[mysqldump] user=user_name password=passwordat the end of the .cnf file.
The above is the detailed content of How to import and export mysql database. For more information, please follow other related articles on the PHP Chinese website!