How to Create a Mysql Database

0
23

Many php scripts available for download require that a mysql database be created so that data can be stored for use with the script itself. This may seem like a daunting task for a beginner. But do not worry, the only difficult part about it is not knowing what to do and that’s what we’re here to teach you.

It’s assumed that you already have a web host and access to hosting administration like cPanel, Plesk, etc. We’ll be using cPanel for the purposes of this lesson as it’s commonly installed on Linux servers. However, most major hosting control panels have the same basic principles which can be applied here.

Log In And Create The Database

The first step is to log into cPanel as the user for the domain that your script will be hosted with. This is accomplished by going to domain.com/cpanel in your browser and replacing domain.com with your domain name. You then enter your hosting username and password given to you by your hosting company.

Once you are logged in scroll down the page to Databases and click the MYSQL Database Wizard icon. This is where we create the actual database. Enter your database name in the “New Database:” field and click Next Step.

If you plan on having more than one database the name should be descriptive to help keep everything organized. For example, for a database used for ecommerce you might name it ecomm. CPanel will add a prefix of your main hosting username and password so your final database name may end up looking like this: username_ecomm.

Add A MYSQL User

Next, we need to add a user that can access and modify the database. Enter the username you wish to use for the database and create or generate a password with the Generate Password function. Be sure your password is a combination of letters, numbers, and symbols to make it as secure as possible. Your username will appear similar to the database name as the hosting username prefix will be added to it as well. For example, username_dbuser. Once these values are entered click Next Step to continue.

Give The User Privileges

Now we give the user privileges so that they may actually work with the database. Usually, you will select the All Privileges box and this is satisfactory for most script installations. If you do not want the user to be able to modify the database but would still like them to be able to access the records you would select the Select box and so on. Click the Next Step button to finish.

Congratulations!

You’ve just created a database and a user that you can now use with your Php scripts. Many of these scripts have a configure file that contains settings with default values for database name and users. You simply open this file with your favorite text editor, like notepad, and change the default values to what you just created. This enables them to install the tables needed to run the script itself.

Source

Leave a Reply