phpMyAdmin for beginners: export, import and delete a database
· The AYT team · 5 min read

phpMyAdmin is a web interface for MySQL and MariaDB databases, included in most hosting panels. In it you export a database to a .sql file (the Export tab), import such a file into an empty database (the Import tab) and delete tables or a whole database (the Operations tab, or from your hosting panel). You don't need to write SQL for any of it.
This guide uses the labels of phpMyAdmin's English interface, the one you see on most servers.
What phpMyAdmin looks like
On the left is the list of databases. Click one and you see its tables, with the tabs you work in along the top:
- Structure: the tables, their row counts and sizes;
- SQL: a box where you run queries;
- Search: finds text across all tables;
- Export and Import: backups and restores;
- Operations: rename, copy and delete.
A WordPress site usually has around 12 tables with the wp_ prefix (wp_posts, wp_options, wp_users and others), plus the plugins' tables. You'll find the site's database name in wp-config.php, under DB_NAME. Check it before any import or deletion, so you work on the right database.
How to export a database
- Click the database in the list on the left.
- Open the Export tab.
- Leave the method on "Quick" and the format on "SQL".
- Click Export (Go in older versions). The browser downloads a file called
database_name.sql.
For large databases, choose "Custom": under "Compression" select gzip, so the file is several times smaller, and under "Tables" you can export only some tables. The "Add DROP TABLE" option puts commands in the file that delete existing tables before the import, which helps when you import over an older copy.
If the export stops halfway or the downloaded file is empty, the database is too large for PHP's time limit. Use your host's backup or a backup plugin that exports in chunks.
How to import a database
- Create a new, empty database in your hosting panel, with a user that has rights on it. Or empty the database you're importing into.
- In phpMyAdmin, click that database on the left.
- Open the Import tab and choose the file (
.sql,.sql.gzor.zip). - Leave the other options as they are and click Import (or Go).
Next to the file button you'll see the size limit, for example "(Max: 64MiB)". It comes from the PHP settings upload_max_filesize and post_max_size. A gzip-compressed file usually fits under the limit even when the .sql file is much bigger.
If you're importing the database of a WordPress site that moved to a new domain, the old addresses stay in the database. Don't replace them with an UPDATE in SQL: many WordPress settings are stored serialized, and a raw replacement breaks them. Use a search-and-replace tool made for WordPress; the steps are in our guide to moving a WordPress site.
The most common import errors
#1062 Duplicate entry or #1050 Table already exists
You're importing over tables that already exist. Import into an empty database, or export again with "Add DROP TABLE" ticked.
#1044 Access denied for user to database
The file contains a CREATE DATABASE or USE command with the database name from the old server. On shared hosting you aren't allowed to create databases from SQL. Export again without "Add CREATE DATABASE", or delete those lines at the top of the file with a text editor.
#1273 Unknown collation: utf8mb4_0900_ai_ci
The database was exported from MySQL 8, and the new server runs MariaDB older than 11.4.5 or MySQL 5.7, neither of which knows this collation. Replace utf8mb4_0900_ai_ci with utf8mb4_unicode_ci in the file and import again.
The file is too big
Compress it with gzip. If it's still over the limit, raise upload_max_filesize and post_max_size as shown in our guide to upload_max_filesize and post_max_size, or ask your host to import the file.
How to delete tables or a database
Before any deletion, export. A deleted database has no undo button.
For tables: in the Structure tab, tick the tables, then choose "Empty" (removes the rows, keeps the table) or "Drop" (deletes the table entirely) from the menu at the bottom. phpMyAdmin asks you to confirm.
For a whole database: in the Operations tab, under "Remove database", click "Drop the database (DROP)" and confirm. On shared hosting, the database user usually isn't allowed to delete the database, and a database deleted in phpMyAdmin would still be listed in the panel anyway. Delete it from your hosting panel's databases page, where you can also delete its user separately if nothing else uses it.
How to run an SQL query
The SQL tab is handy for quick checks. For example, you can find the WordPress site's address with:
SELECT option_name, option_value FROM wp_options WHERE option_name IN ('siteurl', 'home');
SELECT queries only read. UPDATE and DELETE change data immediately, with no confirmation, so run them only after an export. A concrete example, resetting the administrator's password, is in our guide to resetting a WordPress password in phpMyAdmin.
phpMyAdmin on AYT hosting
On AYT hosting, phpMyAdmin opens straight from the panel. You create and delete databases and users on the panel's Databases page, and you allow access from another computer in Remote MySQL. For WordPress, WordPress Toolkit has a database search and replace that handles serialized data. On paid plans, the daily backup includes your databases, and you start a restore from the panel.

