Tuesday, November 01, 2011

Tutorial How to set up a MYSQL database for Joomla using cpanel

As I set up my database I created a series of screenshots, you can view them and follow along with the procedure . . .  

How to set up a MYSQL database for Joomla, using cpanel

Before you can use Joomla you must have a mysql database into which Joomla will store all the content for you website. These instructions show how to set you a mysql database, using the popular cpanel control panel that is provided by many web hosting services.
This tutorial assumes . . .
  •     your hosting service uses the cpanel control panel
  •     you know how to open cpanel
  •     you have already uploaded the Joomla package to your server

Database setup for Joomla

These are the steps, we'll work through them with screenshots of each to show exactly how set up the database for Joomla.
   1. Open your cpanel control panel, then select the MYSQL icon by clicking it
   2. Enter a name for the new database then create the database
   3. Enter a name and password for a user of databases in general, then create the user
   4. Allocate the user to the new database
Here are the detailed instructions with screenshots, the confirmation screens are not shown - otherwise this would be a much longer page.

1 Open the cpanel control panel

Start by opening cpanel, in most cases you will enter something like http://your_domain_name.co.uk/cpanel then log in with your username and password. The exact method will vary depending on your hosting service. When you arrive at the cpanel you will see something like this . . .
 cpanel mysql
cpanel screenshot showing mysql icon

Click the MYSQL Databases icon to use the MYSQL tools

2 Create a new database using cpanel

In the box labeled New Database type the name you want for the database.
If your hosting package is on a server that is shared between many users you may find that the actual database name is something like your login name followed by the name you typed in the box. This happens because there is only one copy of MYSQL on the server and it is shared between all the users.
This is not usually a problem, but if you have a very busy site that appears to serve slowly at peak times then you may need to upgrade your hosting package.
You will get a confirmation screen - write down the details.
type the name of the mysql database 
Type the name you want for the database in the box, then click the Create Database button

3 Set up a user for the database you created

Enter a username and password for the database user. This should be different from your hosting login and password. My personal preference is for a distinct user for each database for additional security.
 add a mysql user to a database
Type the username and password you are going to use to access this database, then click Create User.
You will get a confirmation screen telling you that the user was added and showing the password, write them both down and keep a careful note of them ready for the Joomla installation.

4 Associate the user with the database

When using MYSQL with cpanel you need to associate the user that you created with the database you created. That is because mysql can handle a very large number of users all of whom can have different privileges.
There are two drop-down list showing users and databases, select the appropriate items, make sure the 'ALL' checkbox is checked and click the Add User to Database button.
associate a user with a database mysql
Select the appropriate user and database from the drop down lists then click the Add User to Database button
Make sure that the ALL checkbox is checked. This means that the user will have all the privileges to do anything with the database.

Progress review

So far we have created a new database, created a database user and assigned the user to the database that Joomla will use. Now we can begin the first run of Joomla and tell it about the database. 

5 Enter database details into Joomla

You need the following information from earlier in this tutorial
  • database name
  • database user name
  • database password
The designers of Joomla have done a really good job by making the installation process easy. After you have uploaded Joomla to your server you use a web browser to open it. Usually this means pointing your browser at the domain, it will be something like www.mydomain.com/administrator
Joomla goes through a series of steps, starting with selection of your languge, then pre-installation checks to make sure that your server is capable of running the scripts and is set up as expected. Next you view the license and agree the terms before entering the database details.
Steps in Joomla setup

6 Tell Joomla about the mysql database you created earlier in this tutorial

Joomla goes through a series of checks on your server to make sure that things are set the way they need to be, then it comes to the screen that asks for the database details.
joomla mysql setup
form into which you type your database details for Joomla setup
Type the details you wrote down earlier in this tutorial, then click the Next button (top right of your screen)
In the next step you can set up a special ftp (file transfer protocol) user, if you're not sure what this is or are not yet ready to do it you can safely skip over that step to the configuration where you set up your first user.
Assuming that goes well your Joomla installation will now work.
One important step that you really MUST do is to delete the installation directory. If you don't do that, someone could go through the installation again and destroy all your hard work.

No comments: