This article explains how to use phpMyAdmin to create a table in a mySQL database.
1. Select the database you wish to use and click the 'phpMyAdmin' button (this will log you in automatically).
2. Once in phpMyAdmin, you will be taken to the Database Structure page. This is a list of all the tables contained in a database. As this database is newly created, there are no tables.
To add a table, give it a name and specify the number of columns, before continuing.
In this example, we'll be creating a table named 'users' with two columns, to store users' emails and passwords.
3. Next, you'll be presented with a screen where you can specify the name and properties of each column, as well as the configuration of the table.
- The name (required) allows you to specify the name of the column. Self-explanatory.
- Next, you'll need to choose a type (required). I recommend using INT for numbers, VARCHAR for strings and TIMESTAMP for dates / times. You can read more about the different mySQL data types here: https://bit.ly/2DPWNhw.
- Length (required) specifies the maximum number of characters the given column can store. For example, a column of length 255 can store no more than 255 characters. Different types of data accept different maximum values, but I always enter 255 for VARCHAR as this is compatible with older versions of mySQL.
- You may also want to set a default value (optional). mySQL defaults to this if no other value is specified, when inserting values into a table. The CURRENT_TIMESTAMP option records the time the row was inserted into the table, for example.
- You probably won't need to use the other options, but you can learn about them in the phpMyAdmin documentation.
- For the storage engine, select 'MyISAM' and leave the other fields blank.
- Press 'Save' to create the table.
4. If the table was created successfully, you should see a screen resembling the one below. Have a look at some of the other phpMyAdmin tutorials to learn how to insert rows into a table.