Using phpMyAdmin to Manage MySQL/MariaDB Databases
phpMyAdmin is a browser-based interface for managing MySQL and MariaDB databases — useful for importing/exporting data, running queries, and managing users without the command line.
Install phpMyAdmin (Ubuntu/Debian)
apt install phpmyadmin -y
During installation, select your web server (Apache or Nginx) and configure the database with dbconfig-common.
Manual Installation (Nginx)
cd /var/www
wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz
tar -xzf phpMyAdmin-latest-all-languages.tar.gz
mv phpMyAdmin-*-all-languages phpmyadmin
chown -R www-data:www-data phpmyadmin
Create an Nginx location block or virtual host pointing to /var/www/phpmyadmin.
Security: Restrict Access by IP
Add this to your Nginx config for the phpMyAdmin location:
location /phpmyadmin {
allow 203.0.113.100; # Your IP only
deny all;
root /var/www;
}
Key Features
- Create, browse, edit, and delete databases and tables
- Run SQL queries in a browser-based editor
- Import and export databases as SQL, CSV, or other formats
- Manage database users and privileges
- View and modify table structure
Security Recommendations
- Never expose phpMyAdmin on a public URL without IP restrictions or HTTP basic auth
- Use a non-obvious URL path (e.g.,
/dbadmin-a7x2/instead of/phpmyadmin/) - Keep phpMyAdmin updated
- Use a dedicated MySQL user with limited privileges rather than root