Introduction:

This basic tutorial will guide you on how to create a MySQL database and how to write data to tables. MySQL is a simple, yet powerful Open Source Software relational database management system that uses SQL (Structured Query Language). MySQL databases are being used more and more in web applications and offer an easy way store/retrieve large amount of information. Thus, it is imperative to understand how to use these databases.

Part 1: Creating the database

You can manually enter data into the database using the MySQL query method or using the GUI method. That being said, programmers often use a PHP script to write data to MySQL databases, and similarly, use PHP scripts to extract data from MySQL databases. This tutorial will not go into the PHP side, as it is beyond the scope of this tutorial.

To use the MySQL database, you must have a web host that supports PHP and MySQL. I currently use BlueHost as my webserver, and it works well for the applications that I run. Although this tutorial is specific to BlueHost as the web host, it is general enough to be applied to other web hosts.

  1. Depending on what web host service you use, there will be different ways of allowing you to create a database. Most likely, you have a control panel system that contains a simple database request form. For instance, using BlueHost as the example, there is a “Databases” section in the control panel:

    Database Menu

  2. The easiest way to create a database is to use the MySQL Database Wizard, which will guide you in the steps needed to create a database. Create a table with the desired name. In many cases, only the administrator (or the main account) of the web host can create databases.

    Create Database Prompt

  3. Next, create a database user. Type in your desired username and password.

    Create Database Users

  4. An important thing to remember is to be sure to assign users the privileges to access the database. Granting users privileges can allow them to write, modify, delete, and perform other actions related to that database. Later on, when you start to use PHP scripts to modify your databases, this feature will come in quite handy. But for now, you really don’t have to worry too much about it.

    User Privileges

Congratulations, you have now created a MySQL database, and you have granted access to the users who will be reading/writing information to the MySQL database!

Pages: 1 2 3