MySQL common commands

Mysql export table structure and table data mysqldump usage

 
    The specific usage under the command line is as follows: mysqldump -u user name -p password -d database name table name script name;

    1. Export the table structure of the database as dbname (where the user name is root, the password is dbpasswd, and the generated script name is db.sql)
    mysqldump -uroot -pdbpasswd -d dbname >db.sql;

    2. Export the database as a table (test) structure of
    dbname mysqldump -uroot -pdbpasswd -d dbname test>db.sql;

    3. Export the database All table structures and table data for dbname (without -d)
    mysqldump -uroot -pdbpasswd dbname >db.sql;

    4. Export the database as a table (test) structure and table data of dbname (without -d)
    mysqldump - uroot -pdbpasswd dbname test>db.sql;

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326405512&siteId=291194637