Connecting to a MYSQL Database Part 1

The Finished Page

Okay so in this article I am going to explain how I create and connect to a live mysql database.

First and foremost I am am going to assume that the reader already has a web hosting package with a hosting company that provides database services, companies such as 1&1IONOS or GoDaddy and many others.

Just for transparency I am using a 1&1 package, but the process is nearly identical whoever you decide to use. You should familiarise yourself with navigating your control panel or cPanel.

Create the Database

  • The first thing you need to do is go to your respective control panel and go to manage databases. From here you need to select create database
  • Next give the database a description or name and create a secure password (make a note of these for later)
  • You may have to create a new user or one may be created for you, and you may well need to link the user to the database, or again this may be done for you. Once you have done all this you should have an info screen similar to the one below.
  • Next we need to go into our database, so click open and you should see your phpMyAdmin screen and on the left your database should be listed
  • Click on the database, and when presented with the Create table screen enter clients_tbl and increase the number of columns to 6, then hit Go
  • Now we create the columns, name them and give them their properties. In the name field enter the name id, give it the Type INT, the length 10. Then move across to the index and select PRIMARY and tick the A_I (auto increment) box. Fill the next five rows as shown and select the Collation utf8_general_ci. When you are happy hit save.

Okay that is our database created with the relevant clients table (clients_tbl) added. In Part 2 we are going to create the php files required to connect and interact with your newly created database.

« | »