Somewhere behind almost every dynamic website sits a database. Your WordPress posts, your store's orders, your users and their settings all live in tables of rows and columns. Most of the time you never see it. Then one day you need to change a site URL, reset a stuck setting, or restore a backup, and someone says, "Just do it in phpMyAdmin."
phpMyAdmin is a free, open-source web application for managing MySQL and MariaDB databases through your browser. Most control panels, including cPanel and DirectAdmin, include it. This guide shows you how to use phpMyAdmin safely, even if you have never touched a database before.
First rule: back up before you change anything
phpMyAdmin has no undo button. A deleted row, a dropped table, or a bad search-and-replace is permanent unless you have a backup. Before any edit, export the database (covered below). It takes seconds and turns a disaster into a minor inconvenience.
Opening phpMyAdmin
On most hosting accounts:
- Log in to your control panel.
- Find the Databases section and click phpMyAdmin.
- It opens in a new tab, usually already logged in with your account's database access.
If your host or server asks for a username and password, use a database user that has access to the database you want to manage.
Finding your way around
The screen has two main areas.
- Left sidebar: a list of databases. Click the plus sign or name of one to see its tables.
- Main panel: tabs that change depending on what you have selected, such as Structure, SQL, Search, Export, Import, and Operations.
Which database is my site using?
If you have several databases, check your application's configuration file. For WordPress, open wp-config.php and look for DB_NAME. Laravel and many other apps keep this in a .env file as DB_DATABASE. Match that name in the sidebar.
Databases, tables, rows, and columns
- A database is a container for one application's data.
- A table holds one kind of thing, like posts, users, or orders. WordPress tables start with a prefix, by default
wp_, such aswp_postsandwp_options. - A row is one record (one post, one user).
- A column is one field of that record (title, email, date).
Browsing and editing data
Click a table name, and phpMyAdmin shows the Browse tab with its rows. You can:
- Sort by clicking a column header.
- Edit a row with the pencil icon, change a value, and click Go to save.
- Delete a row with the delete icon (think twice).
A real example: fix the WordPress site URL
If you changed your domain and WordPress keeps redirecting to the old one:
- Open your WordPress database and click the
wp_optionstable (your prefix may differ). - Find the rows where
option_nameissiteurlandhome. They are usually on the first page. - Edit each
option_valueto your correct URL, such ashttps://www.example.com, with no trailing slash. - Save, then reload your site.
Note that this only changes those two settings. Links inside your posts still point to the old domain. For a full domain change, use a serialization-aware tool such as WP-CLI's search-replace command or a reputable plugin, because a plain text replacement can corrupt serialized data that WordPress stores in the database.
Searching your database
The Search tab at the database level lets you find a word or value across many tables at once. Enter the text, choose which tables to search, and phpMyAdmin lists how many matches each table has. This is handy for tracking down where a stray old URL, email address, or odd piece of text is stored.
Running SQL queries
The SQL tab lets you type queries directly. A few safe, read-only examples:
SELECT * FROM wp_users;
SELECT option_name, option_value FROM wp_options WHERE option_name = 'active_plugins';
SELECT COUNT(*) FROM wp_posts WHERE post_status = 'publish';
SELECT statements only read data, so they are a good way to learn. Be far more careful with UPDATE, DELETE, and DROP. An UPDATE or DELETE without a WHERE clause affects every row in the table. Before running one, write the matching SELECT first to see exactly which rows it would touch.
Exporting a backup
- Click the database name in the sidebar.
- Open the Export tab.
- Choose Quick export method and SQL format.
- Click Export (or Go) to download a
.sqlfile.
The Custom method lets you pick specific tables, add DROP TABLE statements, or compress the file with gzip, which is useful for larger databases. Store the file somewhere off the server, not just in your hosting account.
Importing a database
To restore a backup or move a database from another host:
- Create the empty database first if it doesn't exist (in your control panel's MySQL Databases tool, along with a user that has privileges on it).
- Select that database in phpMyAdmin's sidebar.
- Open the Import tab, choose your
.sqlor compressed.sql.gzfile, and click Import (or Go).
Importing into a database that already contains tables with the same names can fail or overwrite data, depending on what the file contains. When restoring, it is often cleanest to import into an empty database.
When the file is too big
phpMyAdmin's upload size is limited by PHP settings on the server, and you'll see the maximum on the Import screen. If your file is larger:
- Compress it with gzip; phpMyAdmin can import compressed files directly.
- Split the export into several smaller files by table.
- Use the command line if you have SSH access:
mysql -u user -p database_name < backup.sql. - Ask your host for help importing it.
Useful table operations
- Structure tab: see columns, types, and indexes. Good for understanding how an app stores data.
- Check and Repair: select tables, then pick Check table or Repair table from the "With selected" menu. Repair applies to certain table types, such as MyISAM; InnoDB tables generally recover on their own.
- Optimize table: can reclaim space after many deletions.
- Empty vs Drop: Empty (truncate) removes all rows but keeps the table. Drop deletes the table entirely. Both are permanent.
Staying safe
- Back up first. Every time.
- Never edit password columns as plain text. Applications store hashed passwords. Use the app's own password reset where possible.
- Don't leave phpMyAdmin exposed on a server you manage yourself. On a VPS, restrict it by IP, put it behind extra authentication, or skip installing it and use an SSH tunnel with a desktop client.
- Use the least access you need. Create database users with privileges only on the databases they need.
Common errors
- "#1045 Access denied": wrong username or password, or the user lacks privileges on that database.
- "#1062 Duplicate entry": you are inserting a row with a key that already exists, often from importing on top of existing data.
- "#1044 Access denied to database": the import file contains a
CREATE DATABASEstatement with a different name. Remove it or import into the database you selected.
Wrap-up
Once you know how to use phpMyAdmin, your database stops being a black box. Browse tables to understand how your site stores data, use SELECT queries to look before you change, export backups before every edit, and import carefully into empty databases. Treat it with respect and it becomes one of the most useful tools in your hosting account.
Related reading: MySQL Basics for Website Owners: Databases, Tables and Users Explained.