How To Manage Your PostgreSQL Database Manager
Quick Intro
The PostgreSQL Database Manager allows you to create and manage your databases. Keep in mind that the database takes up your disk space. You can connect your databases to your web projects or any other hosted CMS using your database credentials.
Important To Know Before You Begin
To create a database, you must set up a Database Name, Database Username, and Database Password.
By default, the Database Username is the same as your Database Name. You can set any custom Database Name if you deselect (Same As Database Name).
The Database Password can be generated randomly if you click the icon located in the Password field, or you can set your password.
Each database has unique credentials and does not interfere with other created databases in your account.
Your database credentials will start with a part of your login information, and it's not editable.
Creating New PosgreSQL Database
To create a new database, follow these steps:
-
Navigate to PostgreSQL Database Manager:
- In your Web Control Panel, go to:
Website Management > Databases > PostgreSQL
- In your Web Control Panel, go to:
-
Create a New Database:
- Click on Create Database tab.
-
Enter Database Details:
- Database Name: Enter your desired database name.
- Database Username: By default, the username is the same as the database name. Deselect the option if you need to customize it.
- Database Password: Enter a secure password or generate one using the icon next to the password field.
-
Create the Database:
- Once all fields are filled, click Create DB to finalize the process.
You may encounter some error messages after creating the Database, but you can disregard this and simply refresh the page to see the database being created.
- See the list of PostgreSQL Databases
- Navigate to the List Databses tab to see the database created.
Once your database has been created, you can manage it using a graphical interface via phpPgAdmin, if needed.
- Access phpPgAdmin
- To access phpPgAdmin navigate to List DB Users, find the icon with Arrow and click on it.
Working with Remote PostgeSQL Databases
WebHostMost allows you to connect to remote databases using the Web Control Panel. This feature is particularly useful if you need to manage databases hosted on a different server or wish to access your database from an external application.
Adding a User to a PostgreSQL Database via the Web Control Panel
To connect to a remote database, you first need to ensure that the correct user permissions are set up. Here’s how to add a user to your database:
-
Navigate to Database Management:
- Go to Web Control Panel > Databases > PostgreSQL.
-
Create or Select a PostgreSQL Database:
- If you haven't created the database yet, follow the steps outlined in the Creating New Database section.
- If the database already exists, select it from the list.
-
Add a User:
- Under the Users section, click Add New User.
- Enter the desired username and password.
- Assign appropriate privileges to the user (e.g., SELECT, INSERT, UPDATE, DELETE).
- Click Create User.
Allowing Hostnames or IP Addresses via the Web Control Panel
For remote database connections, you need to specify the hostnames or IP addresses that are allowed to connect to your database. Here’s how to allow remote connections:
-
Access the Database Setup:
- Go to Web Control Panel > Databases > PostgreSQL Database Manager > Manage Users.
-
Add Remote Host:
- Select the user associated with the database.
- In the Access Hosts section, enter the hostname or IP address that will be allowed to connect remotely. You can use
0.0.0.0/0
as a wildcard to allow all IP addresses (not recommended for security reasons). - Click Add Host.
Security Tip: Only allow specific IP addresses or hostnames to access your database remotely. Using wildcards can expose your database to unauthorized access.
Connecting to the Remote PostgreSQL Database
Once you've set up the database user and allowed the necessary hostnames or IP addresses, you can connect to the remote database using any PostgreSQL client, terminal, or application. Here’s how to do it:
Connecting via Terminal to the PostgreSQL
You can connect to your remote database using the PostgreSQL command-line tool. Here’s an example command:
psql -U yourdatabaseusername -h serverX.webhostmost.com -d yourdatabase
Replace yourdatabaseusername
with your database username, serverX.webhostmost.com
with the actual server (where X is the server number), and yourdatabase
with the database name. After running the command, you will be prompted to enter your database password.
Connecting via pgAdmin or Other Tools
- Open your PostgreSQL client (e.g., pgAdmin).
- Enter the following details:
- Host:
serverX.webhostmost.com
(replace X with your server number). - Username: Your database username.
- Password: Your database password.
- Database: Your database name.
- Host:
- Connect to the database.
Best Practices for Remote Database Management
- Use Strong Passwords: Always use strong, complex passwords for database users, especially when allowing remote access.
- Restrict Access: Limit access to only the IP addresses or hostnames that need it. Avoid using wildcards.
- Monitor Activity: Regularly monitor your database activity for unauthorized access or unusual queries.
- Backup Regularly: Always keep backups of your databases, especially when working with remote connections.
Conclusion
With the ability to manage both local and remote PostgreSQL databases through the Web Control Panel, WebHostMost provides a flexible environment for your web projects. By following the steps and best practices outlined in this guide, you can efficiently manage and secure your databases.
For further assistance, don’t hesitate to contact our support team.
Manage your PostgreSQL databases confidently, whether they’re local or remote, by leveraging the powerful tools available in your Web Control Panel.