Forrest logo
back to the mysqldump tool

mysql:database:schema:export:without-data

Export MySQL database schema without exporting its data
$ mysqldump -h ${host_name_or_ip} -u ${username} -p --no-data dbname > ${output_sql_file_path}
try on your machine

This command is used to create a backup of a MySQL database. Here's a breakdown of each part of the command:

  • mysqldump: This is the command to perform a dump of the database.
  • -h ${host_name_or_ip}: This option specifies the hostname or IP address of the server where the database resides.
  • -u ${username}: This option specifies the username to use to connect to the MySQL server.
  • -p: This option tells the command to prompt for a password to connect to the MySQL server.
  • --no-data: This option tells the command to only include the database structure and not the data itself.
  • dbname: This is the name of the database to dump.
  • > ${output_sql_file_path}: This redirects the output of the command to a file specified by the ${output_sql_file_path} variable. This is where the backup of the database will be stored.
This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the mysqldump tool