Sunday, November 1, 2009

PostgreSQL Database in cPanel

This article will explain you on how to manage MySQL or PostgreSQL database in cPanel. After logging into cPanel you will find the MySQL or PostgreSQL icons. CPanel screen lets you to create or work with those types of databases. CPanel uses a similar interface for both types of databases, that’s why most of the web host offers MySQL.
On the MySQL/PostgreSQL cpanel screen you will see four main sections as shown in the figure below. The very first section lets you to create and work with the database. Below that there is another section which allows you to create database users that will be able to access the databases. Next section is to setup remote access to your databases only if your web host allows. At last there is a hyperlink given to phpMyAdmin or phpPgAdmin, the web interfaces for advanced work with your databases.
MySQL PostgreSQL Database cPane
lHow to create a database?
Its not so hard to create database, but there are few things you will need to know. The first thing you are gonna need to create database is the last item in database section. Just write the name of the database into the Db: field and simply click on Add Db button. The database of the name will be created. There will be slightly difference in actual database name you have chosen. It will be created with your cPanel username and with an underscore added before the name you chosen. For example: domain_database1.
How to create a database user?
To use a created database you need atleast one user into the database. For creating a new user simply type a username and password in the “users:” section and click on Add User. A new user will be created immediately. The database username will look like this “domain_robin“.
Now, how to add a user to the database?
Now you have to associate the above created user with the database. Now, if you check out the above Add Db field it has a set of drop-down lists. The first field allows you to select a user that you have created and in second field you have to select the database that you want to associate with that user. Now just click on Add User to Db and its done. Also, you can add a single user to multiple databases if you wish to.Once you have associated a user with the database you will notice that the listing for that database get more detailed. It will show you the database name followed by some links to delete or repair the database and then you will be able to see all the users in the database. Also, it will show you some sample code that shows you how to connect to the database in PHP, Perl or JDBC script.
How to remove or repair a database?Just next to the username there is a button called Delete, but this can be confusing as deleting a user from a database will only remove the user and all the records the user had in that database. It will not affect the actual user you created, it will still work in other databases. As well as there is Check button given to check database for problems, and if it has any errors just click on Repair. And still if that doesn’t work then you must contact your web host.

No comments: