Archive
Categories
- Antivirus (4)
- Applications (5)
- Books and Articles (24)
- Computer Tutorials (10)
- Flash (3)
- Game (4)
- Graphic Design Tutorials (13)
- Internet Software (5)
- Internet Tutorials (12)
- Movie (8)
- Music (4)
- Novel Collections (5)
- Photoshop (10)
- Programming Tutorials (12)
- Template (3)
Tutorial : MySQL Database Tutorials
7:33 AM |
Diposkan oleh
Fiola |
Edit Post
Step 1: How to create and set up a Database
Many people tell me they aren’t very fond of scripts, because the install frightens them a bit. And it’s true: creating a database, importing tables, your site’s root path… if you don’t know what you’re doing, this looks pretty complicated.
Luckily, it is not, once you get the hang of it.
Luckily, it is not, once you get the hang of it.
That’s why I’ve created this step-by-step tutorial on how to set up a database.
I’ve included a screenshot for every step of the way.
The red arrows on the screenshots indicate the required action.
I’ve included a screenshot for every step of the way.
The red arrows on the screenshots indicate the required action.
(I’ve used cPanel to create the database, as this is the most common way)
Included:
Chapter 1 – Creating Your Database & Database User
Chapter 2- Importing Database Tables In phpMyAdmin
Chapter 3 – Configuring Your Script
Chapter 2- Importing Database Tables In phpMyAdmin
Chapter 3 – Configuring Your Script
1. Creating your database
First, you need to log in to cPanel. You will find it when you load http://www.yourdomain.com/cpanel
When you do, you see the screen below:
Click ‘MySQL Databases’ (see the red arrow)
Click ‘MySQL Databases’ (see the red arrow)
A new screen will appear, showing you a list of all your existing databases and
database users:
database users:
Scroll down until you see a field and a button that says ‘Create Database’.
Give your database a name and click the ‘Create Database’ button.
A new window appears, confirming your action:
A new window appears, confirming your action:
Click ‘Go Back’ to go back to the previous page.
On that page, scroll down until you see two fields and a button that says ‘Create User’.
Choose a username and password, and click the button.
The confirmation screen will appear again. Click ‘Go Back’ to go back to the
previous page.
previous page.
On that page, scroll down until you see ‘Add Users To Your Database’.
In the first drop down menu, select the user you just created. In the second drop
down menu, select the database you just created.
Make sure the box next to ‘ALL’ is checked.
down menu, select the database you just created.
Make sure the box next to ‘ALL’ is checked.
Click the button that says ‘Add User To Database’.
Again you will see a confirmation message. Click ‘Go Back’ to go to the previous
page.
page.
NOTE: a prefix has been added to the database name and username you
entered. Make sure to always include that prefix when you need to add your database info in a script!
entered. Make sure to always include that prefix when you need to add your database info in a script!
Scroll down until you see ‘Access Hosts’. Make a note of what’s written there
(usually, this will be ‘localhost’).
(usually, this will be ‘localhost’).
Your database has been created and by now you have all the info you need to run your script’s installer (or to manually edit the script’s configuration file):
• your database name
• your database username
• your password
• your host
• your database username
• your password
• your host
follow Step 2 in the next tutorial.
Step 2:Importing Your Database Tables
Most new scripts come with a built-in installer. All that is resuired to install it, is to load the ‘install.php’ page in your browser and enter your database details in the form that is provided. When the information is submitted, the script creates all database tables automatically. Piece of cake.
Unfortunately, very often there’s no such installer included, and you’ll have to create the database tables manually. – don’t worry – there’s othing to it )
When this is the case, a separate database file will be included in the script’s folder (extension: ‘.sql’). Usually it’s named ‘db.sql’, but this can be anything. Check your script’s installation manual to find out.
This is the file you need to import into your empty database to create the database tables. To find out how to do this, read on.
Still on the same page in your cPanel, click ‘phpMyAdmin’.
This will open phpMyAdmin in a new window:
In the left drop down menu, select the database you’ve just created.
The database name will be followed by ‘(0)’, since you haven’t created any tables yet.
The database name will be followed by ‘(0)’, since you haven’t created any tables yet.
The left frame will show the following message: ‘No tables found in database’.
In the right frame, click the ‘Import’ tab.
In the right frame, click the ‘Import’ tab.
Click the ‘Browse’ button.
Browse to your script’s folder, select the ‘db.sql’*-file and click ‘Open’.
(*check your script’s installation manual to find out the name of the file that containes the database info)
(*check your script’s installation manual to find out the name of the file that containes the database info)
Click ‘Go’ to start the import.
When your import has been successful, your tables will be created. In the left
frame, you’ll see the number of tables that have been created appear behind
your database name, and you’ll see a list of all those tables below that.
frame, you’ll see the number of tables that have been created appear behind
your database name, and you’ll see a list of all those tables below that.
You can close both phpMyAdmin and cPanel and go on installing your script.
follow Step 3 in the next tutorial.
Step 3: Configuring the script with the database details
Instructions on where and how to add your database info to the script’s configuration file should be described in your script installation guide, since this is different for each and every script.
Basically, your configuration file will contain this piece of code (or a variation):
After adding your database info, this is how it will look like:
Upload the customzed file to your server.
Your Done!
Label:
Programming Tutorials,
Tutorial
Subscribe to:
Post Comments (Atom)
0 komentar:
Post a Comment