How to Create, Edit, and Delete Database Using phpMyAdmin
Previously we have discussed how to create a ForeignKey, today we will discuss how to create database using phpMyAdmin, as well as edit and delete it.
Actually all of the database creation, with any tools, done by running the SQL commands, but by using tools, such as phpMyAdmin, will make it easier, because the SQL commands will be automatically created and run by these tools.
I. How to Create Database Using phpMyAdmin
To create database using phpMyAdmin, follow the following steps:
- Login into phpMyAdmin, then clicks on the Database tab menu at the top.
- On the next page enter the database name and choose a collation. Collation itself is used to specify the character set and the “collation” used by the database. You can leave it as is.
Character set is a type of character that can be accommodated by the database, while the database collation determines the way of database compares the characters, such as when sorting the data (ascending or descending) or compare characters in a where statement.
For more details, you can read this article: Character Set and Collation On MySQL
- Next, click the create button to create the database.
II. How to Edit Database Using phpMyAdmin
After we successfully creating a database, later we may want to edit the database. This editing process includes rename the database, copy the database, change the collation, etc. To edit database using phpMyAdmin, follow these steps:
- Click database you want to edit
- Click the Operations tab menu located at the top side.
- Next, choose the operation you want to do. For example, to rename the database, choose the “Rename database” section and enter the new database name. If you want to copy the database, fill parameter in the “Copy Database To” section. Once finished click the “GO” button to execute the sql command.
Note: MySQL doesn’t have a query to rename the table, to rename it, phpMyAdmin will create a database and tables exactly the same as the old one, and then delete the old database.
So, be careful if your database contains huge of data, it could happen a situation where the process of making the database and the tables are not completed (not all copied), in such case the data will be lost.
III. How to Delete Database Using phpMyAdmin
Sometimes the database we have created is no longer needed may be due to outdated or replaced with a new database. The steps to delete database using phpMyAdmin are almost the same as before:
- Click database you want to edit and then click the Operations tab menu located at the top side.
- Click on the “Drop the database (DROP)” link which is on the Remove Database section.
A popup window will appear to confirm whether you really want to delete the database. Click Yes to continueWARNING: The deletion is permanent, once removed, the database can not be restored, so, be careful.
Deleting Multiple Databases At Once
Furthermore, in some situation, we may want to delete multiple databases, to do so, click the “Server” link located on the breadcrumbs (on top) usually “Server: 127.0.0.1” , and then check the database name you want to remove.
Once finished, click the “Drop” button