数据库
获取数据库服务器列表
命令
mogwai databases servers list
示例输出
ID NAME TYPE LOCAL HOST USERNAME AVAIL
1 mysql(localhost) mysql true fastuser true
2 postgresql(localhost) postgresql true fastuser true
服务器 IDs 会在其他命令中使用。
获取数据库列表
命令
mogwai databases list
示例输出
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
同步数据库列表
如果您最近添加或删除了数据库,但它们尚未显示在 FASTPANEL 中,您可以强制同步这些列表
命令
mogwai databases sync
创建新数据库
命令
mogwai databases create [flags]
选项
-n,--name=NAME:数据库名称。-o,--owner="fastuser":将添加该数据库的 FASTPANEL 用户。-s,--site=SITE:将在 FASTPANEL 中添加该数据库的网站。-c,--charset="utf8mb4":数据库编码。-u,--username=USERNAME:数据库用户名。-p,--password=PASSWORD:数据库用户密码。
示例命令
mogwai databases create --server=1 -n db1 -o fastuser -s example.com -u dbuser -p dbpassword1
此命令将在默认数据库服务器(--server=1)上创建一个名为 db1 的数据库,并将其“绑定”到 example.com 站点。