Database Management Accounts and Connection Information
When using ServBay for database management, it is crucial to understand how to obtain and use database connection information. This document provides a detailed introduction to the management accounts and connection information for MariaDB, PostgreSQL, and Redis that come with ServBay.
Obtaining Database Connection Information
The connection information for ServBay's MariaDB and PostgreSQL databases can be found in the settings of the ServBay management panel. The specific steps are as follows:
- Open the ServBay management panel.
- Navigate to
Settings
. - Select
Database Password
.
On this page, you will be able to view the connection information for MariaDB and PostgreSQL, including the username, password, host address, and port.
MariaDB Connection Information
- Username: Obtain from the management panel
- Password: Obtain from the management panel
- Host Address:
localhost
- Port:
3306
(default port)
PostgreSQL Connection Information
- Username: Obtain from the management panel
- Password: Obtain from the management panel
- Host Address:
localhost
- Port:
5432
(default port)
Redis Connection Information
- Host Address:
127.0.0.1
- Port:
6379
(default port) - Password: Default is no password
Using Socket Connection
If users choose to connect to the database using a socket, ServBay provides the corresponding socket file path.
MariaDB Socket Connection
- Socket File:
/Applications/ServBay/tmp/mysql.sock
Connection Example:
mysql -u your_username -p -S /Applications/ServBay/tmp/mysql.sock
PostgreSQL Socket Connection
- Socket File:
/Applications/ServBay/tmp/.s.PGSQL.5432
Connection Example:
psql -U your_username -h /Applications/ServBay/tmp -d your_database
Example Connection Commands
Below are some example commands for connecting to the MariaDB, PostgreSQL, and Redis databases that come with ServBay.
Connect to MariaDB
Using TCP/IP:
bashmysql -u your_username -p -h localhost -P 3306
1Using Socket:
bashmysql -u your_username -p -S /Applications/ServBay/tmp/mysql.sock
1
Connect to PostgreSQL
Using TCP/IP:
bashpsql -U your_username -h localhost -d your_database -p 5432
1Using Socket:
bashpsql -U your_username -h /Applications/ServBay/tmp -d your_database
1
Connect to Redis
Using TCP/IP:
bashredis-cli -h 127.0.0.1 -p 6379
1Using Socket:
Currently, connecting to Redis using a socket is not supported.
Summary
Understanding and obtaining the connection information for MariaDB, PostgreSQL, and Redis that come with ServBay is an important step in database management. Through the ServBay management panel, you can easily obtain the connection information for MariaDB and PostgreSQL. Redis uses the default port without a password by default. For socket connections, ServBay provides the corresponding socket file path, making it convenient for users to connect locally.