Setting up MySQL.
A common need in a website is MySQL. MySQL can be used to store all kinds of information; user information, numbers, strings, file contents, website addresses, anything.
Setting up MySQL on your account is easy! Follow this simple tutorial to get it setup in no time at all
First you need to get your cPanel settings if you haven't already. Now login. When cPanel has loaded scroll down to "Databases" and click on the "MySQL Databases" icon. You will be taken to a new screen where you can control databases and users.
Next we need to create a database. To do this, click in the box where you find "New Database:" and give your database a suitable name, now click the "Create Database" button. You should be shown a confirmation screen similar to "Added the database phpBB3" where phpBB3 is the name of your database.
Now scroll down till you find the "MySQL Users" category. You should see a form which will ask for you to enter a, username, password and password (again). Fill this in with the MySQL user you want to create. As you type a password it will be checked against a password analyser. This analyser will check to see if your password is secure. Red = unsecure, Yellow = medium and Green = secure, don't worry too much if your password is red or yellow. Now click the "Create User" button.
So far we have a database and a user, but neither of these are connected. If you do not follow this step, you will not be able to connect to your database! Below where we just created a user you should see another category, "Add User to Database". First select your user from the dropdown box, next select the database you want to give permissions to that user to. Now click the "Add" button. You will be taken to a new screen which will ask which permissions you want to give that user, for full access click the "All Privileges" button.
Now we are ready to connect! Below is the PHP code for to connect to a database.
If you are given an error, check your username and password match. For a remote connection (accessing a database else where, change localhost to either your domain name, or sub-domain, jobloggs.benokshosting.co.uk) otherwise submit a ticket and we will look into it.
Please do not post your username or password on the forum!
We hope this helps you!
Add to Favourites
Setting up MySQL on your account is easy! Follow this simple tutorial to get it setup in no time at all
First you need to get your cPanel settings if you haven't already. Now login. When cPanel has loaded scroll down to "Databases" and click on the "MySQL Databases" icon. You will be taken to a new screen where you can control databases and users.
Next we need to create a database. To do this, click in the box where you find "New Database:" and give your database a suitable name, now click the "Create Database" button. You should be shown a confirmation screen similar to "Added the database phpBB3" where phpBB3 is the name of your database.
Quote:
To keep the VPS running smoothly and efficiently, your username will be added to the beginning of any database you make, jobloggs_phpBB3.
Now scroll down till you find the "MySQL Users" category. You should see a form which will ask for you to enter a, username, password and password (again). Fill this in with the MySQL user you want to create. As you type a password it will be checked against a password analyser. This analyser will check to see if your password is secure. Red = unsecure, Yellow = medium and Green = secure, don't worry too much if your password is red or yellow. Now click the "Create User" button.
Quote:
To keep the VPS running smoothly and efficiently, your username will be added to the beginning of any extra users you make, jobloggs_admin.
So far we have a database and a user, but neither of these are connected. If you do not follow this step, you will not be able to connect to your database! Below where we just created a user you should see another category, "Add User to Database". First select your user from the dropdown box, next select the database you want to give permissions to that user to. Now click the "Add" button. You will be taken to a new screen which will ask which permissions you want to give that user, for full access click the "All Privileges" button.
Now we are ready to connect! Below is the PHP code for to connect to a database.
Code:
<?php
mysql_connect("localhost", "jobloggs_admin", "p@ssw0rd") or die(mysql_error());
?>
mysql_connect("localhost", "jobloggs_admin", "p@ssw0rd") or die(mysql_error());
?>
If you are given an error, check your username and password match. For a remote connection (accessing a database else where, change localhost to either your domain name, or sub-domain, jobloggs.benokshosting.co.uk) otherwise submit a ticket and we will look into it.
Please do not post your username or password on the forum!
We hope this helps you!
Add to Favourites
- cPanel
- FTP Access
- MySQL Databases
- Addon Domains
- Webmail and POP3
- File Manager
- phpMyAdmin
- Fantastico De Luxe
Your email is added.