Skip to main content

Databases

Getting a list of database servers​

Command

mogwai databases servers list

Example output

ID NAME TYPE LOCAL HOST USERNAME AVAIL
1 mysql(localhost) mysql true fastuser true
2 postgresql(localhost) postgresql true fastuser true

The server IDs is used in other commands.

Getting a list of databases​

Command

mogwai databases list

Example output

ID NAME SERVER_NAME LOCAL HOST CHARSET OWNER SIZE CREATE_AT
1 db1 mysql(localhost) localhost true utf8mb4 user 0 2024-05-28 10:03:03.227413266 +0000 UTC
2 database43s mysql(localhost) localhost true utf8mb4 user82 0 2024-05-28 10:07:15.001640584 +0000 UTC

Synchronizing the database list​

If you have recently added or removed databases, and they have not yet appeared in FASTPANEL, you can force synchronization of the lists

Command

mogwai databases sync

Creating a new database​

Command

mogwai databases create [flags]

Options

  • -n, --name=NAME : Database name.
  • -o, --owner="fastuser" :  FASTPANEL user to whom the database will be added.
  • -s, --site=SITE : Website in FASTPANEL to which the database will be added.
  • -c, --charset="utf8mb4" : Database encoding.
  • -u, --username=USERNAME : Database username.
  • -p, --password=PASSWORD : Database user password.

Example command

mogwai databases create --server=1 -n db1 -o fastuser -s example.com -u dbuser -p dbpassword1

This command will create a database named db1 on the default database server (--server=1) and "binds" it to the example.com site.