phpMyAdmin reference

Complete reference for phpMyAdmin configuration directives, authentication settings, server parameters, and common SQL statements used through the web interface.

Complete reference for phpMyAdmin configuration directives, authentication settings, and common SQL statements executed through the phpMyAdmin web interface.

phpMyAdmin Authentication Configuration Directives

phpMyAdmin stores authentication and connection settings in the config.inc.php file. Each directive controls how phpMyAdmin authenticates users and connects to the MySQL or MariaDB server.

DirectiveDescriptionDefaultExample
$cfg['Servers'][$i]['auth_type']Authentication method phpMyAdmin uses to verify MySQL credentials. cookie prompts for login on each session. config reads credentials from the config file. http uses HTTP Basic Authentication.'cookie'$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['host']Hostname or IP address of the MySQL/MariaDB server that phpMyAdmin connects to. Use localhost for local connections or a remote IP for external servers.'localhost'$cfg['Servers'][$i]['host'] = '203.0.113.10';
$cfg['Servers'][$i]['port']TCP port number phpMyAdmin uses to connect to the MySQL server. MySQL listens on port 3306 by default. MAMP uses port 8889.'' (3306)$cfg['Servers'][$i]['port'] = '3307';
$cfg['Servers'][$i]['socket']Unix socket file path for local MySQL connections. Faster than TCP for same-machine connections. MAMP uses /Applications/MAMP/tmp/mysql/mysql.sock.''$cfg['Servers'][$i]['socket'] = '/var/run/mysqld/mysqld.sock';
$cfg['Servers'][$i]['ssl']Enables SSL/TLS encryption for the connection between phpMyAdmin and the MySQL server. Required for remote database connections over untrusted networks.false$cfg['Servers'][$i]['ssl'] = true;
$cfg['Servers'][$i]['AllowRoot']Controls whether phpMyAdmin allows login with the MySQL root account. Set to false on production servers to prevent root access through the web interface.true$cfg['Servers'][$i]['AllowRoot'] = false;
$cfg['Servers'][$i]['AllowNoPassword']Controls whether phpMyAdmin allows login with an empty password. Set to false to reject passwordless MySQL accounts.false$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['blowfish_secret']Secret key phpMyAdmin uses to encrypt cookie-based session tokens. Must be at least 32 characters for secure cookie encryption.''$cfg['blowfish_secret'] = 'a1b2c3d4e5f6...';

phpMyAdmin Session and Display Configuration

phpMyAdmin controls session behavior, upload limits, and interface settings through directives in config.inc.php and PHP's php.ini file.

DirectiveDescriptionDefaultExample
$cfg['LoginCookieValidity']Duration in seconds before phpMyAdmin's login cookie expires and requires re-authentication. Must match or be lower than PHP's session.gc_maxlifetime.1440$cfg['LoginCookieValidity'] = 1800;
$cfg['LoginCookieStore']Controls cookie persistence. 0 stores the cookie for the browser session only. A positive integer stores it for that many seconds across browser restarts.0$cfg['LoginCookieStore'] = 0;
$cfg['ForceSSL']Forces phpMyAdmin to redirect all HTTP requests to HTTPS. Enable this after configuring a TLS certificate on the web server.false$cfg['ForceSSL'] = true;
$cfg['TempDir']Directory path phpMyAdmin uses for template caching and temporary files. The web server process must have write permissions to this directory.''$cfg['TempDir'] = '/tmp/phpmyadmin';
$cfg['UploadDir']Server directory path from which phpMyAdmin allows SQL file imports. Bypasses PHP upload size limits for large database files.''$cfg['UploadDir'] = '/var/lib/phpmyadmin/upload';
$cfg['SaveDir']Server directory path where phpMyAdmin saves exported database files directly on the server instead of downloading through the browser.''$cfg['SaveDir'] = '/var/lib/phpmyadmin/save';

phpMyAdmin Configuration Storage Directives

phpMyAdmin uses a dedicated phpmyadmin database to store bookmarks, query history, table relationships, and other metadata. These directives map phpMyAdmin features to their storage tables.

DirectiveDescriptionDefault Table
$cfg['Servers'][$i]['pmadb']Database name phpMyAdmin uses for its internal configuration storage. Import create_tables.sql to create the required tables.'phpmyadmin'
$cfg['Servers'][$i]['bookmarktable']Table phpMyAdmin uses to store saved SQL query bookmarks for quick re-execution.'pma__bookmark'
$cfg['Servers'][$i]['relation']Table phpMyAdmin uses to store custom foreign key relationships displayed in the Designer view.'pma__relation'
$cfg['Servers'][$i]['history']Table phpMyAdmin uses to store the SQL query execution history for each user session.'pma__history'
$cfg['Servers'][$i]['tracking']Table phpMyAdmin uses to track schema changes (ALTER TABLE, CREATE TABLE, DROP TABLE) as a change log.'pma__tracking'
$cfg['Servers'][$i]['userconfig']Table phpMyAdmin uses to store per-user display preferences and interface settings.'pma__userconfig'

Common SQL Statements in phpMyAdmin

phpMyAdmin executes standard SQL statements against MySQL and MariaDB databases. These statements cover the most frequent database operations performed through the phpMyAdmin SQL editor.

phpMyAdmin Database Management SQL

StatementDescriptionExample
CREATE DATABASECreates a new MySQL database with the specified character set and collation. phpMyAdmin executes this when clicking Createon the Databases tab.CREATE DATABASE store CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
DROP DATABASEPermanently deletes a MySQL database and all its tables, data, and indexes. phpMyAdmin prompts for confirmation before executing this statement.DROP DATABASE old_store;
SHOW DATABASESLists all databases the authenticated MySQL user has permission to access. phpMyAdmin displays this list in the left sidebar navigation.SHOW DATABASES;

phpMyAdmin Table Management SQL

StatementDescriptionExample
CREATE TABLECreates a new table with column definitions, data types, indexes, and constraints. phpMyAdmin generates this statement from the table creation form.CREATE TABLE users (id INT AUTO_INCREMENT PRIMARY KEY, email VARCHAR(255) NOT NULL UNIQUE);
ALTER TABLEModifies an existing table structure by adding, changing, or dropping columns, indexes, or foreign key constraints.ALTER TABLE users ADD COLUMN phone VARCHAR(20) AFTER email;
DROP TABLEPermanently deletes a table and all its rows from the database. phpMyAdmin confirms this action before execution.DROP TABLE IF EXISTS temp_data;
TRUNCATE TABLERemoves all rows from a table without deleting the table structure. Faster than DELETE for clearing large tables because it resets AUTO_INCREMENT.TRUNCATE TABLE session_logs;

phpMyAdmin Data Manipulation SQL

StatementDescriptionExample
SELECTRetrieves rows from one or more tables based on filter conditions. phpMyAdmin displays results in a browsable table with edit and delete options per row.SELECT * FROM users WHERE is_active = 1 ORDER BY created_at DESC;
INSERT INTOAdds one or more new rows to a table. phpMyAdmin generates this statement from the Insert tab form.INSERT INTO users (email, name) VALUES ('user@example.com', 'John Doe');
UPDATEModifies existing rows that match the WHERE condition. phpMyAdmin generates this statement when editing a row through the Browse tab.UPDATE users SET is_active = 0 WHERE last_login < '2024-01-01';
DELETERemoves rows that match the WHERE condition. phpMyAdmin prompts for confirmation before executing DELETE statements.DELETE FROM users WHERE user_id = 42;

phpMyAdmin User and Privilege SQL

StatementDescriptionExample
CREATE USERCreates a new MySQL user account with authentication credentials. phpMyAdmin generates this from the User Accounts tab.CREATE USER 'app_user'@'localhost' IDENTIFIED BY 'secure_password';
GRANTAssigns specific privileges (SELECT, INSERT, UPDATE, DELETE) to a MySQL user on a database, table, or column level.GRANT SELECT, INSERT ON store.* TO 'app_user'@'localhost';
REVOKERemoves previously granted privileges from a MySQL user account.REVOKE DELETE ON store.* FROM 'app_user'@'localhost';
FLUSH PRIVILEGESReloads the MySQL privilege tables to apply changes made with GRANT or REVOKE statements.FLUSH PRIVILEGES;

phpMyAdmin External Resources