Connecting to the Server
In this tutorial, we'll walk through the steps to establish a direct connection to the PostgreSQL database used by Nakama.
Prerequisites
- Access: Ensure you have access to your Nakama server.
- Credentials: Have your PostgreSQL connection details (host, port, database, username, and password).
- Client: Install a PostgreSQL client such as
psqlor use a GUI tool like pgAdmin.
Connection Details
Typical connection details for the Nakama PostgreSQL server are:
- Host:
your-nakama-server-host - Port:
5432(default PostgreSQL port) - Database:
nakama - User:
your-database-username - Password:
your-database-password
Connecting Using psql
Open your terminal and run the following command:
psql -h your-nakama-server-host -p 5432 -U your-database-username -d nakama
You will be prompted to enter your database password.
Using a .pgpass File
To avoid entering your password every time:
- Create or edit the
~/.pgpassfile with the following entry:your-nakama-server-host:5432:nakama:your-database-username:your-database-password - Secure the file permissions:
chmod 600 ~/.pgpass
Connecting Using pgAdmin
If you prefer a graphical interface:
- Open pgAdmin and create a new server connection.
- In the server settings, enter the connection details provided above.
- Save your configuration and connect.