Posted for Chelle. Thank you so much for doing this
Feedback/Suggestions will be much appreciated.
If youíre on the Shuttle plan, youíve been given one database. Perhaps youíve installed the nifty board/Nuke/shopping cart/phpMyChat via Cpanel, using the one click, no worries install. Now you want something else on your site that requires a database. So you simply do another one click install, but it tells you you need a database. Oh no!
Fear not. If you donít want to buy another database, this How To will show you how to add to your existing database. Basically what youíll be doing is adding tables to your existing database. First things first, getting acquainted with your database tools.
On CPanel, you have an icon that says MySQL Databases. Click on that.
If you installed anything using CPanel, the database was automatically created for you. Per the figure, the user name is the user name you were given when you first got your Lunarpages account. The data base name is the name of your database. The syntax is that your user name is the prefix for anything related to the database, as you can see in the figure. In this figure, chelle is the user name created for the database.
As a review, syntax is as follows:
*NOTE: the prefix isnít attached to the passwords. Bear that in mind when you edit any config files.
The one click install already created a user. You can see this in the figure above. This picture shows the users in the database nuke, which is usern2_chelle. It shows the user, the privileges granted, and the option to Delete the user. usern2_chelle has all privileges. For the things your installing the user you put into your config files needs to have the ĎAll Privilegesí box checked. For simplicity, you can use the same user that the one click install created. If this is fine, skip down to Using phpMyAdmin
If you want to create a different user, follow the following steps:To create a user for your database
Scroll down to the next section.
Enter a username and a password, then click Add User. You should see the new user when the page refreshes. For this example, usern2_chelle will be the user for the database.
Now you have to add this user to the database. Basically you're letting the database know that this user is ok'ed to manipulate the data stored in there. Scroll up till you see this
[orange arrow indicators] Select the user you just created in the drop down box. Make sure the ĎAll Privilegesí box is checked. Then click Add user. You should see your new user when the page refreshes. Now you're set as far as the user is concerned.Using phpMyAdmin
Scroll to the bottom of the page, and click on phpMyAdmin [red circle].
Youíll get a pop up asking for a user name and password. Use the user name and password given to you by Lunar Pages. A new page will open up. Sometimes, Iíll get an error page. Just refresh and phpMyAdmin should load. Once logged in, you should get a screen like this:
This tool will help you manage the data in your database. Click where indicated on the figure [yellow arrows]. If you click Databases you'll see your database name, click on that. Depending on what you installed will determine what you see. In my case, I had Nuke installed, so I saw rows of nuke_filename where nuke is the prefix for all the table entries associated with my Nuke install. These are table entries.
If you let your mouse settle over the icons, it will tell you their function.
1st: Browse will let you browse the content of that table.
2nd:Search will let you search through the data in that table
3rd:Insert will let you insert a new instance of data into the table
4th:Properties will show you the table properties of the fields in it
5th:Drop: the red trashcan deletes the whole table, everything
6th:Empty: the white trashcan just empties out the data in the table, but leaves the table still there.
A breakdown of terminology:
Table: A database is made up of tables, that contain information
Field: is a value in the table. For instance, when you register somewhere, Name is a field within the a table. A table can have many fields.
Data: specific values held in fields. What you input. So the data in the field ĎNameí would be Joe Smith.Creating Tables in phpMyAdmin
The file that actually creates tables is the .sql file that should be in the files you've downloaded. Most times it's in its own folder called sql. Now there are one of two things you're going to be doing. You're either going to edit the .sql file or you'll leave it alone. If you're installing another of the same thing [in my case, I have two instances of Nuke installed on my site], you'll need to edit the .sql file. It's really simple. If you're not, then you just need to know where the .sql file is located. [If this applies, you can skip to the next section].When you have to edit the .sql file
Using Nuke as an example: the file that creates the database for Nuke is nuke.sql. A quick way to create a new set of tables for an additional instance of nuke is to open nuke.sql in an editor, click on search/find and enter the word nuke and have it replaced with a new name. For simplicity sake, I replaced nuke with nuke2. Save your new .sql file under a new filename.
The reason you're doing this is because you already have tables in your database with the 'nuke' prefix. So to have a totally different instance of nuke on your site, you will have to give its tables a different prefix. To see an example, compare http://portal.sansdreamscape.net
They look the same [theme being the same was my doing], but the data is different. A good way to see this is to look at the Forums module. The posts, and even the boards themselves aren't the same because the data for each has their own 'home.' Uploading the .sql File
Now, in your phpMyAdmin window, click the link in the lower left hand corner 'Query window' A new window will pop up.
Click on import files [middle tab at the top]. Click Browse and choose the .sql file you've changed [if you're installing two of the same thing] or the .sql file that came with the downloaded files. In this case, the new file saved was nuke2.sql. Then click go.
After a moment, your page should refresh and you should get a message informing you of how many new tables were recreated. On your left, the frame should refresh, showing the new tables as well.
You've just created the database for your what you wanted to install. Now, follow the rest of the installation instructions. In this case, for my second installation of nuke, I have all the tables it needs [the nuke2 tables]. The config.php file for that instance should look like:
$dbhost = "localhost";
$dbuname = "usern2_chelle";
$dbpass = "your_chosen_password_here_without_usern2_prefix";
$dbname = "usern2_nuke";
$prefix = "nuke2";
$user_prefix = "nuke2";
$dbtype = "MySQL";
$sitekey = "your_chosen_site_key";
$gfx_chk = 6;
$subscription_url = "";
Essentially you can copy your original config file and just change the prefix and user prefix unless you created a different user. Just make sure the user you put in your config file has been added to the database and has all privileges. [See above steps].
Congrats, you've just added table to your existing database! Go you