This tutorial will take you through the steps to follow for creating a table in a database using phpMyAdmin in cPanel. I’m assuming that you have already created your database.
Create a table:
- Log into cPanel account.
- Click on phpMyAdmin in the DATABASES section. You can also type phpMyAdmin in the search box to filter the contents of the screen easily.
- A new browser tab will open.
- Click on the database you had created earlier from the left navigation pane.
- Since your database does not have a table, phpMyAdmin will automatically take you to “create table” page.
- Type the name of the table and specify the number of columns needed.
- Indicate column names, data types and lengths as needed. More about MySql data types can be found from their official documentation.
- Set the primary key.
- Specify the storage engine. Read more about MySql storage engines from the official website.
- Click on Save once you’re through.
How to copy a table from another database in phpMyadmin
If you already have your table’s structure definition in a different database, then you can easily copy it.
- From the left navigation pane in phpMyAdmin, select the database that has the table structure.
- Select the table by clicking on it.
- Click on options from the tabs at the top.
- In the Copy table to (database.table): section, select the target database.
- Type the name for the new table or you can leave it as it is.
- Specify whether you need both the structure and data or just the structure alone and if you need to switch to the copied table.
- Click on Go button to start the process.
- phpMyAdmin will notify you once the process has finished.
Note: You can also export the table and import it into the target database.
There you go, you have just learnt how to create and copy a table in phpMyAdmin. Drop us your comments and suggestions in the comments area and we’ll be glad to know of what you think.