Data Source Name (DSN)
--dsn option is used to provide a data source name (DSN) to connect databases.
All commands that operate databases require this option, including:
The supported format is
We currently support drivers:
The optional params are:
Here are a few examples:
Apply schema migration to database.
migrate command will be recorded in history. It is recommended that
migrate is only used for applying schema change so that it is more clear to track schema migration.
--file, -f string file stored the migration script.
--command, -c string SQL command that does the migration.
Apply SQL command to the given database.
Apply the migration script to the given database.
Dump the schema and data of a database.
This command is used to back up a database. When given no output file and only dump schema, it can be used to view the current database schema.
--file string File to store the dump. Output to stdout if unspecified.
--schema-only Only dump schema.
Dump the schema and data from all databases in localhost:3306 mysql, to
Print the schema of database
bytebase_test_todo to stdout.
Restore the schema and data of a database from a dump file (usually created by
restore command will NOT be recorded. It is recommended that
restore is used for restoring from an existing database dump, including both schema and data.
--file, -f string file stored the dumped database.
Restore database from backup.sql to the given database.