EXPORT DATABASE CONFIGURATION

Description

The EXPORT DATABASE CONFIGURATION syntax is used to export storage units and rule configurations to YAML format.

Syntax

Grammar Railroad diagram

  1. ExportDatabaseConfiguration ::=
  2. 'EXPORT' 'DATABASE' 'CONFIGURATION' ('FROM' databaseName)? ('TO' 'FILE' filePath)?
  3. databaseName ::=
  4. identifier
  5. filePath ::=
  6. string

Supplement

  • When databaseName is not specified, the currently used logical database will be exported; if no database is used, No database selected will be prompted;
  • When filePath is not specified, the exported information will be output through the result set;
  • When filePath is specified, the file will be automatically created. If the file already exists, it will be overwritten.

Example

  • Export currently used logical database
  1. mysql> EXPORT DATABASE CONFIGURATION;
  2. +-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  3. | result |
  4. +-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  5. | databaseName: sharding_db
  6. dataSources:
  7. ds_1:
  8. password: 123456
  9. url: jdbc:mysql://127.0.0.1:3306/db0
  10. username: root
  11. minPoolSize: 1
  12. connectionTimeoutMilliseconds: 30000
  13. maxLifetimeMilliseconds: 2100000
  14. readOnly: false
  15. idleTimeoutMilliseconds: 60000
  16. maxPoolSize: 50
  17. ds_2:
  18. password: 123456
  19. url: jdbc:mysql://127.0.0.1:3306/db1
  20. username: root
  21. minPoolSize: 1
  22. connectionTimeoutMilliseconds: 30000
  23. maxLifetimeMilliseconds: 2100000
  24. readOnly: false
  25. idleTimeoutMilliseconds: 60000
  26. maxPoolSize: 50
  27. rules:
  28. |
  29. +-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. 1 row in set (0.01 sec)
  • Export the specified logical database and output it to file
  1. mysql> EXPORT DATABASE CONFIGURATION FROM sharding_db TO FILE '/xxx/config_sharding_db.yaml';
  2. +-------------------------------------------------------------------------+
  3. | result |
  4. +-------------------------------------------------------------------------+
  5. | Successfully exported to: '/xxx/config_sharding_db.yaml' |
  6. +-------------------------------------------------------------------------+
  7. 1 row in set (0.02 sec)

Reserved word

EXPORT, DATABASE, CONFIGURATION, FROM, TO, FILE