Several common use cases: 1. Export the entire database mysqldump -u username -P database name> export file name mysqldump -u wcnc -p smGp_apps_wcnc> wcnc.sql2. Export a table mysqldump -u username -P database name name> Export file name mysqldump -u wcnc -p smGp_APPS_WCNC USERS> WCNC_USERS.SQL3. Export a database structure mysqldump -u wcnc -p -d -dd-drop-table smGp_apps_wcnc> d: /wcnc_db.sql -d no data - no data - Add-drop-table Add a DROP TABLE 4. Import the database to the mysql database console, such as the mysql -u root -p mysql> Use database, then use the Source command, then use the Source command ( As used here. SQL) mysql> source d: /wcnc_db.sql5 import data to text
Echo "Select .. from ..." | mysql -u username database name -p> tmp.txt