{"id":95,"date":"2026-05-26T10:32:34","date_gmt":"2026-05-26T17:32:34","guid":{"rendered":"https:\/\/cpanelreview.com\/index.php\/2026\/05\/26\/manage-mysql-databases-cpanel-phpmyadmin-guide\/"},"modified":"2026-05-26T10:32:34","modified_gmt":"2026-05-26T17:32:34","slug":"manage-mysql-databases-cpanel-phpmyadmin-guide","status":"publish","type":"post","link":"https:\/\/cpanelreview.com\/index.php\/2026\/05\/26\/manage-mysql-databases-cpanel-phpmyadmin-guide\/","title":{"rendered":"How to Manage MySQL Databases in cPanel with phpMyAdmin: A Complete Guide"},"content":{"rendered":"\n<p>If you manage websites, you&#8217;re probably familiar with cPanel&#8217;s MySQL section. But are you using phpMyAdmin effectively? Many users skip past it or only use it for basic database creation. In reality, phpMyAdmin is a powerful tool that can help you troubleshoot performance issues, fix broken WordPress sites, export and import data safely, and manage database users with precision \u2014 all without touching a command line.<\/p>\n\n\n\n<p>This guide walks through the most common and useful MySQL database management tasks in cPanel using phpMyAdmin. Whether you&#8217;re a WordPress site owner trying to rescue a broken site or a sysadmin looking for faster workflows, these steps will save you time and headaches.<\/p>\n\n\n<!--more-->\n\n\n<h2 class=\"wp-block-heading\">Accessing phpMyAdmin in cPanel<\/h2>\n\n\n\n<p>Before you can manage your databases, you need to know how to reach phpMyAdmin. The path is the same across virtually every cPanel version:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Log into your cPanel dashboard (usually <code>https:\/\/yourdomain.com\/cpanel<\/code>)<\/li>\n<li>Scroll to the <strong>Databases<\/strong> section<\/li>\n<li>Click the <strong>phpMyAdmin<\/strong> icon<\/li>\n<\/ul>\n\n\n\n<p>That&#8217;s it. phpMyAdmin opens in a new tab, showing you all databases associated with your cPanel account. If you don&#8217;t see a particular database, double-check that it was created under your cPanel user account \u2014 databases owned by other users on the same server won&#8217;t appear here.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Creating and Managing MySQL Databases<\/h2>\n\n\n\n<p>While you can create databases directly from the phpMyAdmin interface, it&#8217;s usually better to create them through cPanel&#8217;s <strong>MySQL Databases<\/strong> wizard first. This ensures the database name follows cPanel&#8217;s naming convention (your username prepended to the database name) and properly links the database to your user.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Creating a Database in cPanel<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In cPanel, click <strong>MySQL Databases<\/strong> under the Databases section<\/li>\n<li>Enter a name for your new database in the <strong>Create New Database<\/strong> field<\/li>\n<li>Click <strong>Create Database<\/strong><\/li>\n<li>Go back to the same page and create a database user under <strong>MySQL Users<\/strong><\/li>\n<li>Add the user to the database with <strong>All Privileges<\/strong> selected<\/li>\n<\/ul>\n\n\n\n<p>Once the database and user exist, you can open phpMyAdmin to manage the tables inside it. This two-step process (create in cPanel, manage in phpMyAdmin) is the standard workflow used by most hosting providers.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Managing Database Users and Privileges<\/h3>\n\n\n\n<p>phpMyAdmin gives you granular control over user privileges. After opening phpMyAdmin, click the <strong>Privileges<\/strong> tab at the top. You&#8217;ll see a list of all MySQL users. Click <strong>Edit Privileges<\/strong> next to any user to fine-tune their permissions.<\/p>\n\n\n\n<p>For security-conscious setups, follow the principle of least privilege:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>WordPress sites<\/strong>: <code>SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, INDEX, DROP<\/code> \u2014 avoid granting <code>CREATE TEMPORARY TABLES<\/code> or <code>LOCK TABLES<\/code> unless specifically needed<\/li>\n<li><strong>Read-only users<\/strong>: Only <code>SELECT<\/code> and <code>SHOW VIEW<\/code> \u2014 perfect for analytics dashboards or reporting tools<\/li>\n<li><strong>Installation users<\/strong>: Full privileges temporarily during setup, then reduce after the install completes<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Exporting and Importing Databases<\/h2>\n\n\n\n<p>One of the most common tasks in phpMyAdmin is moving data between environments \u2014 from production to staging, or from one host to another. phpMyAdmin handles this cleanly with its import and export features.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Exporting a Database (Backup)<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In phpMyAdmin, click the database name in the left sidebar<\/li>\n<li>Click the <strong>Export<\/strong> tab at the top<\/li>\n<li>Choose <strong>Quick<\/strong> (for a full backup) or <strong>Custom<\/strong> (for selective export)<\/li>\n<li>Select the <strong>SQL<\/strong> format (default, works everywhere)<\/li>\n<li>Check <strong>Add DROP TABLE \/ VIEW \/ PROCEDURE \/ FUNCTION<\/strong> to ensure clean imports on the destination<\/li>\n<li>Click <strong>Go<\/strong> to download the <code>.sql<\/code> file<\/li>\n<\/ul>\n\n\n\n<p>For large databases (over 100MB), phpMyAdmin&#8217;s web export can time out or produce incomplete files. In those cases, use cPanel&#8217;s <strong>Backup<\/strong> tool or run <code>mysqldump<\/code> via SSH instead:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysqldump -u username -p database_name > backup.sql<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Importing a Database (Restore)<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In phpMyAdmin, select the target database from the left sidebar<\/li>\n<li>Click the <strong>Import<\/strong> tab<\/li>\n<li>Click <strong>Choose File<\/strong> and select your <code>.sql<\/code> file<\/li>\n<li>Leave <strong>SQL<\/strong> as the format<\/li>\n<li>Click <strong>Go<\/strong> at the bottom<\/li>\n<\/ul>\n\n\n\n<p>phpMyAdmin limits file uploads to whatever your server&#8217;s PHP <code>upload_max_filesize<\/code> and <code>post_max_size<\/code> allow (commonly 128MB or 256MB). For files larger than that, use the <strong>MySQL Databases<\/strong> section in cPanel, which offers a dedicated import tool through the command line, bypassing PHP&#8217;s limits entirely.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Running SQL Queries Directly in phpMyAdmin<\/h2>\n\n\n\n<p>Not every task has a clickable button. When you need to run raw SQL, phpMyAdmin provides a full query interface. This is especially useful for troubleshooting WordPress issues, bulk updates, or correcting data.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Common SQL Queries for WordPress Troubleshooting<\/h3>\n\n\n\n<p><strong>Find and replace URLs<\/strong> \u2014 useful after migrating a WordPress site to a new domain:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>UPDATE wp_options SET option_value = REPLACE(option_value, 'http:\/\/olddomain.com', 'https:\/\/newdomain.com');\nUPDATE wp_posts SET post_content = REPLACE(post_content, 'http:\/\/olddomain.com', 'https:\/\/newdomain.com');\nUPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'http:\/\/olddomain.com', 'https:\/\/newdomain.com');\nUPDATE wp_usermeta SET meta_value = REPLACE(meta_value, 'http:\/\/olddomain.com', 'https:\/\/newdomain.com');<\/code><\/pre>\n\n\n\n<p><strong>Reset a forgotten admin password<\/strong> \u2014 this sets the password to &#8220;newpassword&#8221; (change it immediately after logging in):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>UPDATE wp_users SET user_pass = MD5('newpassword') WHERE user_login = 'admin';<\/code><\/pre>\n\n\n\n<p><strong>Identify large tables<\/strong> \u2014 find out which tables are consuming the most space:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT table_name AS \"Table\", ROUND(((data_length + index_length) \/ 1024 \/ 1024), 2) AS \"Size MB\"\nFROM information_schema.TABLES\nWHERE table_schema = \"your_database_name\"\nORDER BY (data_length + index_length) DESC;<\/code><\/pre>\n\n\n\n<p>To run any of these, click the <strong>SQL<\/strong> tab in phpMyAdmin, paste your query into the text area, and click <strong>Go<\/strong>. Always double-check your <code>WHERE<\/code> clauses \u2014 a missing condition can update every row in the table, which is hard to undo without a backup.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Performance Optimization and Maintenance<\/h2>\n\n\n\n<p>Over time, MySQL databases accumulate overhead \u2014 deleted rows leave gaps, indexes fragment, and tables grow larger than necessary. Regular maintenance keeps your database fast and lean.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Optimizing Tables<\/h3>\n\n\n\n<p>To reclaim unused space and defragment tables:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open phpMyAdmin and select your database<\/li>\n<li>Scroll to the bottom of the table list<\/li>\n<li>Click <strong>Check All<\/strong><\/li>\n<li>Select <strong>Optimize Table<\/strong> from the dropdown menu<\/li>\n<\/ul>\n\n\n\n<p>Alternatively, run this SQL against all tables at once:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT CONCAT('OPTIMIZE TABLE ', table_name, ';') AS optimize_query\nFROM information_schema.TABLES\nWHERE table_schema = 'your_database_name'\n  AND table_type = 'BASE TABLE';<\/code><\/pre>\n\n\n\n<p>Run the queries this generates individually or pipe them into a maintenance script. Schedule optimization during off-peak hours, as <code>OPTIMIZE TABLE<\/code> locks the table while it runs.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Repairing Corrupted Tables<\/h3>\n\n\n\n<p>If you see errors like &#8220;Table is marked as crashed&#8221; or &#8220;Can&#8217;t open file&#8221; in WordPress, your MySQL table may be corrupted. In phpMyAdmin:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Select your database<\/li>\n<li>Check the box next to the problematic table<\/li>\n<li>Select <strong>Repair Table<\/strong> from the dropdown<\/li>\n<\/ul>\n\n\n\n<p>phpMyAdmin runs <code>REPAIR TABLE<\/code> behind the scenes, which attempts to fix the table structure without data loss. If repair fails, restore from your most recent backup and reapply any changes made after that backup.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common phpMyAdmin Errors and Fixes<\/h2>\n\n\n\n<p>Even experienced users hit roadblocks in phpMyAdmin. Here are the most frequent issues and how to resolve them:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Error<\/th><th>Cause<\/th><th>Fix<\/th><\/tr><\/thead><tbody><tr><td>&#8220;#2006 &#8211; MySQL server has gone away&#8221;<\/td><td>Import file too large or query timeout<\/td><td>Increase <code>max_allowed_packet<\/code> in my.cnf, or split the SQL file into smaller chunks<\/td><\/tr><tr><td>&#8220;#1215 &#8211; Cannot add foreign key constraint&#8221;<\/td><td>Mismatched data types between columns<\/td><td>Ensure both columns use the same data type and size (e.g., both <code>INT(11) UNSIGNED<\/code>)<\/td><\/tr><tr><td>&#8220;#1452 &#8211; Cannot add or update a child row&#8221;<\/td><td>Referenced parent row doesn&#8217;t exist<\/td><td>Insert the missing parent row first, or disable foreign key checks with <code>SET FOREIGN_KEY_CHECKS=0<\/code><\/td><\/tr><tr><td>&#8220;Script timeout passed&#8221;<\/td><td>PHP execution time limit exceeded<\/td><td>Export with the <strong>Custom<\/strong> method and reduce batch sizes, or use cPanel&#8217;s backup tool instead<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Security Best Practices for phpMyAdmin<\/h2>\n\n\n\n<p>phpMyAdmin is a powerful tool, and with power comes risk. Leaving it accessible to anyone on the internet is a common security gap. Follow these practices to keep your databases safe:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Use cPanel&#8217;s built-in access control<\/strong> \u2014 cPanel&#8217;s directory privacy feature (under <strong>Directory Privacy<\/strong> in the Files section) lets you password-protect the phpMyAdmin folder with additional HTTP authentication<\/li>\n<li><strong>Restrict by IP address<\/strong> \u2014 use cPanel&#8217;s <strong>IP Blocker<\/strong> to limit phpMyAdmin access to your office IP or VPN range<\/li>\n<li><strong>Never leave phpMyAdmin sessions idle<\/strong> \u2014 phpMyAdmin automatically logs out after a period of inactivity, but you should still manually log out when finished<\/li>\n<li><strong>Use database users with limited privileges<\/strong> \u2014 don&#8217;t use the root MySQL account for everyday phpMyAdmin work. Create specific users with only the permissions they need<\/li>\n<li><strong>Keep backups before making structural changes<\/strong> \u2014 export the table or database before running <code>ALTER TABLE<\/code>, <code>DROP<\/code>, or large <code>UPDATE<\/code> commands<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Key Takeaways<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Access phpMyAdmin from cPanel&#8217;s Databases section \u2014 it&#8217;s the fastest way to interact with MySQL without SSH access<\/li>\n<li>Create databases and users in cPanel&#8217;s MySQL Databases wizard first, then use phpMyAdmin for detailed management<\/li>\n<li>Always export a backup before running <code>UPDATE<\/code>, <code>ALTER<\/code>, or <code>DROP<\/code> queries \u2014 a missing <code>WHERE<\/code> clause can be catastrophic<\/li>\n<li>Use phpMyAdmin&#8217;s <strong>Optimize Table<\/strong> feature regularly to keep your database running fast<\/li>\n<li>For large imports (over 256MB), use cPanel&#8217;s import tool or command-line <code>mysql<\/code> instead of phpMyAdmin<\/li>\n<li>Restrict phpMyAdmin access by IP or with additional HTTP authentication to prevent unauthorized database access<\/li>\n<li>Apply the principle of least privilege when assigning MySQL user permissions \u2014 only grant what each application actually needs<\/li>\n<\/ul>\n\n","protected":false},"excerpt":{"rendered":"<p>Learn how to manage MySQL databases in cPanel using phpMyAdmin \u2014 from creating databases and users to exporting, importing, optimizing tables, and troubleshooting common errors.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[110],"tags":[250,251,252,249,253],"class_list":["post-95","post","type-post","status-publish","format-standard","hentry","category-database-management","tag-cpanel-mysql-management","tag-database-optimization-cpanel","tag-mysql-troubleshooting","tag-phpmyadmin-guide","tag-phpmyadmin-security"],"_links":{"self":[{"href":"https:\/\/cpanelreview.com\/index.php\/wp-json\/wp\/v2\/posts\/95","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cpanelreview.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cpanelreview.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cpanelreview.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cpanelreview.com\/index.php\/wp-json\/wp\/v2\/comments?post=95"}],"version-history":[{"count":0,"href":"https:\/\/cpanelreview.com\/index.php\/wp-json\/wp\/v2\/posts\/95\/revisions"}],"wp:attachment":[{"href":"https:\/\/cpanelreview.com\/index.php\/wp-json\/wp\/v2\/media?parent=95"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cpanelreview.com\/index.php\/wp-json\/wp\/v2\/categories?post=95"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cpanelreview.com\/index.php\/wp-json\/wp\/v2\/tags?post=95"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}