|
If you need to
install any web software then it's a certainty that you will
need to create a mySQL database and you may even have to use
phpMyAdmin. Since cPanel is such an easy to use platform,
they've made database creation and management exceptionally
easy too which is why so many web hosting mySQL companies
use them! In this short tutorial we'll run through the
basics of creating a mySQL database and using phpMyAdmin to
back up your database driven website.
First of all, I'm going to assume that you have web hosting
with mySQL capabilities and are on a cPanel server,
virtually all hosts will have this. Once you are logged in
to your cPanel you need to scroll down until you see the box
called “Databases”. There are two ways to create a database,
manually or using the Wizard. It's much quicker to do it
manually so I'll run through this.
Click on the MySQL Databases icon and the page will ask you
to enter the name of the new database you want to create.
There are two parts to this, you create a database and then
you create and assign a user to that database. The database
name can be anything you want and can contain letters and
numbers, although I recommend you keep it to something you
can remember.
Once you've create the database you need to create a user
for that database, which can be done further down the same
page where it says MySQL Users – Add New User. The username
can be a maximum of 8 characters and can be letters and
numbers, and this is standard for all web hosting mySQL
companies . The password can contain letters, numbers and
symbols, I recommend you use the Password Generator function
here because it creates very strong passwords, although
remember to copy it down before you close the window! When
you click create user it will confirm the details you
entered.
The next step is to assign the user you just created to the
database we created earlier. You will find this option at
the bottom of the Database management page and you will see
two drop down boxes, one for the User and one for the
Database, select the username you want to add to a
particular database and then click Add. You will be asked
what privileges you want to give, just select “All”. You
will then get a confirmation page telling you that your user
has been added to the database. It's important to note at
this point the format of the database name and user name
because Cpanel adds the hosting username to the front of
them, so if your hosting username to login to cPanel is
'account' then cPanel will add “account_[database name /
username]” - it's important to remember this when copying
the details.
Once you've created the database and installed your website
software, you might find that you need to backup your
database. This can be done very easily using phpMyAdmin
which comes as standard on all web hosting mySQL accounts.
From the main cPanel page, locate the phpMyAdmin icon which
will be in the “Databases” box. When you click on it you
will be taken to a page with a light blue background, in the
left hand column you will see a list of all the databases
that you have created (the number in brackets is how many
tables are in that database). You need to click the database
you want to backup and you will be taken to a new page which
lists a summary of the table names in the left column and
table names with more details in the right column.
In the right hand column you will find a tab near the top of
the page called “Export”, click this and you will be given a
range of options. You don't need to know what most of these
options do, if you just want to take a backup, leave all the
settings on the default and click the “Go” button on the
bottom right of the page. This will load a new page with
lots of code in a text area. Simply select all the code and
paste it in to a Notepad file and save it. That's all you
need to do, you've backed up your database! Now if you need
to restore it at any point you can send this file to a
programmer who will know what to do.
|