Friday, December 11, 2009

Creating a MySQL Database and MySQL User

If you run a PHP based dynamic website which needs to utilize a database, then you will most likely consider using a MySQL database to store the data which your PHP based application will need to access and use to ensure that it is able to run effectively and efficiently. MySQL is an open source database platform, which means it is free and is one reason why you will find it as part of almost any Linux based website hosting package; it is installed as part of cPanel which means that you will find it included with almost any cPanel based website hosting package.

If you create a MySQL database, then you will need to create a MySQL user so that your PHP applications are able to access your MySQL database so that they are able to delete and add new data to the database. In order to create a MySQL database, you will need to choose the ‘MySQL Databases’ option from the databases category. You will then be taken to the following page:

Picture%208
The only piece of information that you will be required to enter is the name of the database that you want to create. Once you click ‘create’, you will be taken to a page which should confirm that the database has been successfully created. However, once you have created a database, you will want to create a MySQL user to allow your PHP and dynamic web applications to access the database.

In order to create a MySQL database user, you will need to return to the MySQL databases homepage. You will then need to scroll down to the MySQL users section:

Picture%209
You will then be required to enter the following information in order to create the user account:

  • username (circled red) - this is the login that will be used in order for your scripts to access the database
  • password (circled green) - you should apply a password to the user account, otherwise hackers might be able to find a way into your database.

Picture 10
Once you click ‘create’, you should then be redirected to a page which should hopefully confirm that the user account has been successfully created. In order for the user account to be functional with the MySQL database that you have just created, you will need to scroll down to the section labeled ‘Add User to Database’:

Picture%2011
You will need to select the user account that you want to assign, then the database to which you want to assign the user account. Once you have done that, you should then be redirected to a page confirming that the user has been successfully assigned to the database.

With the use of MySQL databases, you should be able to make your website more dynamic in the way that it functions since you will be able to store the content and data that it requires in one central location; this means that users will be able to have a more interactive experience with your website - this means that you are able to provide your website’s visitors with a range of new services based around a database. cPanel allows you to manage any MySQL databases that you create with ease; you can use the web based third party PHPMyAdmin application in order for you to manage your databases via an online interface from any internet connected location, meaning that you are able to manage your cPanel MySQL databases from almost anywhere in the world.

No comments:

Post a Comment