資料庫管理賬號及連接資訊
在使用ServBay進行資料庫管理時,了解如何獲取和使用資料庫的連接資訊是非常重要的。本文將詳細介紹ServBay自帶的MariaDB、PostgreSQL和Redis的管理賬號及連接資訊。
獲取資料庫連接資訊
ServBay的MariaDB和PostgreSQL資料庫連接資訊可以從ServBay管理面板的設置中找到。具體步驟如下:
- 打開ServBay管理面板。
- 導航到
設置
。 - 選擇
資料庫密碼
。
在該頁面,您將能夠查看到MariaDB和PostgreSQL的連接資訊,包括用戶名、密碼、主機地址和端口。
MariaDB連接資訊
- 用戶名:從管理面板獲取
- 密碼:從管理面板獲取
- 主機地址:
localhost
- 端口:
3306
(預設端口)
PostgreSQL連接資訊
- 用戶名:從管理面板獲取
- 密碼:從管理面板獲取
- 主機地址:
localhost
- 端口:
5432
(預設端口)
Redis連接資訊
- 主機地址:
127.0.0.1
- 端口:
6379
(預設端口) - 密碼:預設無密碼
使用Socket方式連接
如果用戶選擇使用Socket方式連接資料庫,ServBay提供了相應的Socket文件路徑。
MariaDB Socket連接
- Socket文件:
/Applications/ServBay/tmp/mysql.sock
連接示例:
bash
mysql -u your_username -p -S /Applications/ServBay/tmp/mysql.sock
1
PostgreSQL Socket連接
- Socket文件:
/Applications/ServBay/tmp/.s.PGSQL.5432
連接示例:
bash
psql -U your_username -h /Applications/ServBay/tmp -d your_database
1
示例連接命令
以下是一些示例命令,用於連接到ServBay自帶的MariaDB、PostgreSQL和Redis資料庫。
連接到MariaDB
- 使用TCP/IP連接:
bash
mysql -u your_username -p -h localhost -P 3306
1
- 使用Socket連接:
bash
mysql -u your_username -p -S /Applications/ServBay/tmp/mysql.sock
1
連接到PostgreSQL
- 使用TCP/IP連接:
bash
psql -U your_username -h localhost -d your_database -p 5432
1
- 使用Socket連接:
bash
psql -U your_username -h /Applications/ServBay/tmp -d your_database
1
連接到Redis
- 使用TCP/IP連接:
bash
redis-cli -h 127.0.0.1 -p 6379
1
- 使用Socket連接:
暫時不支持使用Socket方式連接Redis。
總結
了解和獲取ServBay自帶的MariaDB、PostgreSQL和Redis的連接資訊是資料庫管理的重要步驟。通過ServBay管理面板,您可以輕鬆獲取MariaDB和PostgreSQL的連接資訊。Redis預設無密碼,使用預設端口。對於Socket連接,ServBay提供了相應的Socket文件路徑,方便用戶進行本地連接。