Managing Your Database Using phpMyAdmin
The phpMyAdmin is a tool written in PHP to handle the administration of MySQL over the web. Databases must be created in cPanel or Plesk, but phpMyAdmin can drop databases, create/drop/alter tables, delete/edit/add fields, execute any SQL statement, manage keys on fields, and export data into various formats.
Jump to a Section:
- Accessing phpMyAdmin ⤵
- How to Manage a MySQL Database using phpMyAdmin ⤵
- Common Errors (cPanel) ⤵
- Login to cPanel.
- Click the phpMyAdmin icon in the Databases section.
See the directions on how to access Webadmin. The Webadmin icon takes you to phpMyAdmin for MySQL databases.
Root WHM on a VPS or Dedicated Server
Users with root access to WHM on a VPS or Dedicated Server may also access phpMyAdmin from root WHM.
- Log into WHM.
- Under the SQL Services section, select phpMyAdmin to gain access to every database on the server.
How to Manage a MySQL Database using phpMyAdmin
Managing your MySQL database is a snap using phpMyAdmin, a powerful user interface that is accessed via your HostGator cPanel. This video shows you how to access your databases, create and delete tables, update records, and even import a MySQL file into a database.
This video shows how to access phpMyAdmin via cPanel, and may look slightly different if you have a different cPanel style (theme). Plesk users can access phpMyAdmin by following directions on how to access Webadmin. For MySQL databases in Plesk, clicking the Webadmin icon opens phpMyAdmin. Once inside phpMyAdmin, most of the functionality is the same.
How Do You Analyze the Size of a Database Using phpMyAdmin
Using the phpMyAdmin in your cPanel, you can see the details of your databases and tables. Please refer to this guide.
- Log into the cPanel.
- Scroll down to locate the Databases section.
- Click phpMyAdmin.
- On the left pane, choose your database name. Click the + icon to expand and see the tables in that database.
- Once collapsed, you will see all tables in that database.
- On the right pane, scroll a little bit to view the Size column.
- The phpMyAdmin shows the sizes of each table, and the total size of all tables are shown at the bottom.
How to Check, Optimize, and Repair Tables in phpMyAdmin
- In phpMyAdmin, select the database you wish to optimize.
- Click the + icon to expand and see all tables in that database.
- On the right pane, select the table(s) you wish to optimize. You can also put a checkmark on the Check All checkbox found below the tables.
- Once selected, choose Optimize table from the With selected: drop-down menu below the tables.
Note: You can also select Check table or Repair table from the options.
A confirmation prompt will appear on top to notify you that the query was successful.
How To Delete All Contents of a MySQL Table Using phpMyAdmin
- On the selected database, choose the table you wish to delete the contents. Note: This option would apply to ALL contents of that table.
To delete contents, click the Empty icon located along the row of the selected table.
Alternatively, you can use the Empty option from the With selected: drop-down menu below.
A confirmation prompt will appear on top notifying you about the successful query.
How To Run Queries Using phpMyAdmin
To run SQL queries, please refer to this article, How to Run SQL Queries in phpMyAdmin.
Common Errors (cPanel)
By default, owners logged into WHM cannot access a database through a dependent cPanel's phpMyAdmin. You will get this error:
"This feature is not available while logged in with root override. You are logged in with the root, or reseller's password. Please login with this user's account password"
To resolve this, you will need to log out of root, and log into the individual cPanel in order to access a database via phpMyAdmin.
When you try to enter your phpMyAdmin (cPanel > MySQL > phpMyAdmin) you might be greeted by this error:
#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)
Tables missing. No tables found in the database!
Be sure that the target database does have tables. Tables manually generated with the MySQL Databases section of the cPanel are empty - they are created with no tables.
If you are attempting to import information into a database please follow these instructions:
If the database does have tables in it but are not visible, simply refresh the screen. Alternatively, click the Structure tab at the top
When you see your table name, click the Browse button under the Action menu.
PHPMyAdmin showing a login screen
If clicking on the phpMyAdmin button in your cPanel brings you to a login page for phpMyAdmin, this means that your MySQL and cPanel passwords have become un-synced. You can resolve this yourself by simply changing your cPanel password.