| How to create a database with cPanel and phpMyAdmin |
|
|
|
|
The following is my recommendation for my clients (as of Friday August 29th 2008). This is not intended to be a general primer on web databases. It is simply my current advice for my clients based on their needs. Say you need to create a new MySql database and then edit it. Here's how you do it. (My assumption is that your site has cPanel.) 1. Log in to cPanel. (Don't know your username and password? Ask the webmaster to reset. Note: I'm NOT the webmaster. The webmaster is the person you buy your hosting from.) 2. In the Database section of the page click MySql Databases. 3. You wil see a function to create a new database. This simply creates an empty database with the name you provide. Do this. (Your database name should be simple and not have any spaces or non-alphanumeric characters.) 4. If you wish to use this database as part of a web site you'll probably need to create a user and password for the database. So... scroll down to Add New User and create a new user and password. Generally cPanel will prefix the username you choose with your cPanel username. 5. Now that you have created a user and password, scroll to Add User To Database and choose the user you just create and the database you just created and click Add. 6. You will be taken to a screen where you will be given options for what permissions to give the user for the database. Often you will want to choose All (though if you're only going to use this user within your web site to access data and not write data you might want to give the user fewer permissions). Now you have created database, user and password. To edit the database using phpMyAdmin (an administration tool) go back to the cPanel home page, scroll to the database section, and click phpMyAdmin. A new window will open showing your newly created database (and any other databases used by your site) on the left. A lot of the functions are pretty self explanatory (though for some you may want to study the phpMyAdmin documentation which is available from the opening phpMyAdmin page). Here is one function many people may need. This is the case where you have an entire database on your computer in SQL format (a SQL text file) and you want to upload it to the server. Here are the steps: 1. in phpMyAdmin click on the name of your newly created (empty) database. 2. On the page that opens click the top bar menu item labelled Import. 3. An Import page will open with a Browse/Upload form. You can set a few options here but if you have a properly formed SQL file none should be needed (except perhaps to choose the character set of your SQL file from the dropdown menu - if unsure, try the default). After successful import you will see a message that everything has worked and you see the names of the tables in the database on the left side of the page. That's about it. Note that future changes in phpMyAdmin or cPanel could change some of the exact steps. But likely, for a while at least, the basic steps will continue to work. |













