Database

How to uses mysqldump to get structure or schema data only

mysql-logo We normally use mysqldump to export a database, including both its structure (schema) and data. To export only the structure (schema), add -d or —no-data. Examples: Export only MySQL database structure (schema)

  • Export the structure (schema) of every table in a database: [root@ezylinux ~]# mysqldump -d -u someuser -p database_name or [root@ezylinux ~]# mysqldump --no-data -u someuser -p database_name
  • Export the structure (schema) of a particular table in a database: [root@ezylinux ~]# mysqldump -d -u someuser -p database_name table_name

Here:

  • database_name is the database name.
  • table_name is the table name.
EOF.← Back to articles