Back to Shared Hosting Docs

    phpMyAdmin Guide

    Manage MySQL databases with phpMyAdmin

    What is phpMyAdmin?

    phpMyAdmin is a free web-based tool for managing MySQL databases. It provides a graphical interface to create, modify, and delete databases, tables, fields, and rows, as well as execute SQL statements and manage users and permissions.

    Accessing phpMyAdmin

    1. Log in to your cPanel account
    2. Scroll to the "Databases" section
    3. Click on "phpMyAdmin"
    4. You'll be automatically logged into phpMyAdmin

    phpMyAdmin Interface

    Left Sidebar:

    • Database List: Shows all your databases
    • Expand/Collapse: Click database to see tables
    • Navigation: Click table name to view/edit

    Top Navigation Tabs:

    • Databases: View and manage all databases
    • SQL: Execute SQL queries
    • Status: Server status and statistics
    • Export: Backup databases
    • Import: Restore databases
    • Settings: phpMyAdmin configuration

    Common Tasks

    Browsing a Table

    1. Click on database name in left sidebar
    2. Click on table name
    3. Click "Browse" tab to view data
    4. Use pagination to navigate through rows

    Searching for Data

    1. Select table
    2. Click "Search" tab
    3. Enter search criteria
    4. Click "Go"

    Editing Data

    1. Browse to the record you want to edit
    2. Click "Edit" icon (pencil) next to the row
    3. Modify the values
    4. Click "Go" to save

    Deleting Data

    1. Browse to the record
    2. Click "Delete" icon (X) next to the row
    3. Confirm deletion

    Working with Tables

    Creating a New Table:

    1. Select database in left sidebar
    2. In "Create table" section, enter table name
    3. Enter number of columns
    4. Click "Go"
    5. Define each column (name, type, length, attributes)
    6. Click "Save"

    Modifying Table Structure:

    1. Select table
    2. Click "Structure" tab
    3. Use actions: Change, Drop, Primary, Index, Unique
    4. Add columns using form at bottom

    Executing SQL Queries

    Run SQL Statement:

    1. Select database or table
    2. Click "SQL" tab
    3. Enter your SQL query
    4. Click "Go"

    Select Data:

    SELECT * FROM users WHERE status = 'active';

    Update Data:

    UPDATE users SET email = 'newemail@example.com' WHERE id = 123;

    Delete Data:

    DELETE FROM users WHERE last_login < '2024-01-01';

    Create Index:

    CREATE INDEX idx_username ON users(username);

    Exporting (Backing Up) Databases

    Export Entire Database:

    1. Select database from left sidebar
    2. Click "Export" tab
    3. Choose export method: Quick (default settings) or Custom (more options)
    4. Format: Usually "SQL"
    5. Click "Go"
    6. File will download

    Export Options:

    • Add DROP TABLE: Drops existing tables before recreating
    • Add CREATE DATABASE: Includes database creation statement
    • Add AUTO_INCREMENT: Preserves auto-increment values
    • Compression: gzip or zip for large databases

    Importing (Restoring) Databases

    Import SQL File:

    1. Select database to import into
    2. Click "Import" tab
    3. Click "Choose File" button
    4. Select your .sql file
    5. Format should be "SQL"
    6. Click "Go"
    7. Wait for import to complete

    Note: phpMyAdmin has a maximum upload file size (usually 50-128MB). For larger databases, use cPanel's MySQL Database Wizard or command line tools.

    Optimizing and Repairing Tables

    Why Optimize?

    • • Defragments table data
    • • Reclaims unused space
    • • Improves query performance
    • • Recommended after large DELETE operations

    How to Optimize:

    1. Select database
    2. Check boxes next to tables to optimize
    3. At bottom, select "Optimize table" from dropdown
    4. Click "Go"

    Security Best Practices

    • Strong Passwords: Use complex database passwords
    • Least Privilege: Grant only necessary permissions
    • Regular Backups: Export databases frequently
    • Prefix Tables: Use unique prefixes (e.g., wp_, myapp_)
    • Review Queries: Test SQL carefully before executing

    Common phpMyAdmin Errors

    #1045 - Access Denied

    Username or password incorrect. Verify credentials in cPanel MySQL Databases.

    #1064 - SQL Syntax Error

    SQL query has syntax error. Check for typos, missing quotes, semicolons.

    #2002 - Can't Connect to Server

    MySQL server is down or network issue. Contact hosting support.

    #1044 - Access Denied for Database

    User doesn't have permission. Grant permissions in cPanel MySQL Databases.

    Tips and Shortcuts

    Keyboard Shortcuts:

    • Ctrl+Enter Execute SQL query
    • Ctrl+Shift+; Auto-complete
    • Tab Indent SQL code

    Pro Tips:

    • • Use SQL tab for batch operations
    • • Bookmark queries for reuse
    • • Use LIMIT in SELECT for large tables
    • • Check execution time for slow queries

    Alternatives to phpMyAdmin

    Adminer

    Lightweight alternative

    MySQL Workbench

    Desktop application

    TablePlus

    Modern database client

    Command Line

    Direct MySQL commands via SSH