Introduction to mysql database import and export, functions, and stored procedures bitsCN.com
Mysql common data export commands:
1. mysql exports the entire database
Mysqldump-hhostname-uusername-ppassword databasename> backupfile. SQL
Mysqldump-hlocalhost-uroot hqgr> hqgr. SQL (if the root user does not use the password, you can leave-p. of course, you can create a path for the exported SQL file. if it is not specified, it will be stored in the bin directory of mysql)
2. mysql exports a database table
Mysqldump-hhostname-uusername-ppassword database tablename> exported file name
Mysqldump-hlocalhost-uroot hqgr t_ug_user> user. SQL
3. mysql exports a database structure
Mysqldump-hhostname-uusername-ppassword-d -- add-drop-table databasename> d: hqgrstructure. SQL
-D no data -- add-drop-table adds a drop table before each create statement.
4. if you need to export functions or stored procedures in mysql
Mysqldump-hhostname-uusername-ppassword-ntd-R databasename> backupflie. SQL
Mysqldump-hlocalhost-uroot-ntd-R hqgr> hqgr. SQL
-Ntd indicates the export stored procedure;-R indicates the export function.
Commonly used mysql data import commands:
1. mysql command
Mysql-hhostname-uusername-ppassword databasename <backupfile. SQL
2. source Command
Mysql> source backupfile. SQL
BitsCN.com