{"id":12243,"date":"2025-12-20T10:01:57","date_gmt":"2025-12-20T04:31:57","guid":{"rendered":"https:\/\/www.youstable.com\/blog\/?p=12243"},"modified":"2025-12-20T10:01:59","modified_gmt":"2025-12-20T04:31:59","slug":"setup-phpmyadmin-on-linux-server","status":"publish","type":"post","link":"https:\/\/www.youstable.com\/blog\/setup-phpmyadmin-on-linux-server","title":{"rendered":"How to Setup phpMyAdmin on Linux Server"},"content":{"rendered":"\n<p><strong>To set up phpMyAdmin on a Linux server<\/strong>, install a LAMP or LEMP stack, add the phpMyAdmin package via your distro\u2019s package manager, configure the web server alias, secure access (SSL\/TLS, IP allowlist, Basic Auth), set a blowfish secret, and create a least-privileged MySQL\/MariaDB user. Test at https:\/\/your-domain\/phpmyadmin and harden.<\/p>\n\n\n\n<p>Setting up phpMyAdmin on a Linux server lets you manage MySQL or MariaDB databases through a browser with an intuitive GUI. In this guide, I\u2019ll show you how to setup phpMyAdmin on Linux server environments (Ubuntu\/Debian, RHEL\/CentOS\/AlmaLinux\/Rocky) on both Apache and Nginx, and how to secure it properly for production.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"what-is-phpmyadmin-and-why-use-it\"><strong>What is phpMyAdmin and Why Use it?<\/strong><\/h2>\n\n\n\n<p>phpMyAdmin is an open-source PHP application for managing MySQL\/MariaDB. It offers a web-based interface for creating databases, running SQL queries, importing\/exporting data, and user privilege management. It\u2019s ideal when you prefer a GUI over the command line or when granting controlled access to non-root users and developers.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"search-intent-and-what-youll-learn\"><strong>Search Intent and What You\u2019ll Learn<\/strong><\/h2>\n\n\n\n<p>If you searched for \u201csetup phpMyAdmin on Linux server,\u201d you likely want a practical, step-by-step installation that covers Ubuntu\/Debian and RHEL-based distros, works with Apache or Nginx, and includes essential security hardening. This tutorial delivers all of that, plus troubleshooting, performance tips, and real-world best practices.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"prerequisites\"><strong>Prerequisites<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A <a href=\"https:\/\/www.youstable.com\/blog\/install-mongodb-on-linux\/\">Linux server<\/a> (Ubuntu 22.04\/24.04, Debian 12, Rocky Linux 9, AlmaLinux 9, CentOS Stream, or RHEL 9)<\/li>\n\n\n\n<li>Root or sudo access<\/li>\n\n\n\n<li>DNS pointing to your server (optional but recommended) and a valid domain if using HTTPS<\/li>\n\n\n\n<li><a href=\"https:\/\/www.youstable.com\/blog\/install-apache-web-server-in-linux\/\">Web server<\/a> (Apache or Nginx), PHP 8.x, and MySQL or MariaDB<\/li>\n\n\n\n<li>Firewall access to ports 80 and 443<\/li>\n\n\n\n<li>Basic familiarity with SSH and server administration<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"quick-architecture-overview\"><strong>Quick Architecture Overview<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>LAMP: Linux + Apache + MySQL\/MariaDB + PHP<\/li>\n\n\n\n<li>LEMP: Linux + Nginx + MySQL\/MariaDB + PHP-FPM<\/li>\n\n\n\n<li>phpMyAdmin lives at \/usr\/share\/phpmyadmin (typical) and is served via an alias like \/phpmyadmin<\/li>\n\n\n\n<li>Security is essential: SSL\/TLS, IP allowlist, Basic Auth, strong database credentials, and updates<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"install-phpmyadmin-on-ubuntu-debian-apache\"><strong>Install phpMyAdmin on Ubuntu\/Debian (Apache)<\/strong><\/h2>\n\n\n\n<p>This is the most common stack. Ubuntu\/Debian repositories include phpMyAdmin, making installation straightforward.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"1-install-lamp-packages\"><strong>1) Install LAMP Packages<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt install -y apache2 mysql-server php libapache2-mod-php \\\n  php-mysql php-json php-mbstring php-xml php-curl php-zip php-gd unzip\nsudo phpenmod mbstring\nsudo systemctl enable --now apache2 mysql\n<\/code><\/pre>\n\n\n\n<p>Set a strong MySQL root password and run basic hardening:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mysql_secure_installation\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"2-install-phpmyadmin\"><strong>2) Install phpMyAdmin<\/strong><\/h2>\n\n\n\n<p>Ubuntu\/Debian will prompt you to choose a web server. Select Apache2. If asked to configure a database for phpMyAdmin with dbconfig-common, choose Yes and set a password (or skip and configure manually later).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install -y phpmyadmin\nsudo systemctl reload apache2\n<\/code><\/pre>\n\n\n\n<p>The installer adds an Apache config in \/etc\/apache2\/conf-enabled\/phpmyadmin.conf and an alias \/phpmyadmin.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"3-set-the-blowfish-secret-security\"><strong>3) Set the Blowfish Secret (Security)<\/strong><\/h2>\n\n\n\n<p>phpMyAdmin uses a blowfish secret for cookie encryption. Generate a strong secret and add it to config.inc.php.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo openssl rand -base64 32\nsudo nano \/etc\/phpmyadmin\/config.inc.php\n<\/code><\/pre>\n\n\n\n<p>Add or update:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$cfg&#91;'blowfish_secret'] = 'paste_the_generated_string_here'; \/\/ 32+ random chars\n<\/code><\/pre>\n\n\n\n<p>Then reload Apache:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl reload apache2\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"4-create-a-least-privileged-database-user\"><strong>4) Create a Least-Privileged Database User<\/strong><\/h2>\n\n\n\n<p>Avoid logging in as root in phpMyAdmin. Create a dedicated user with only required privileges.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mysql\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE USER 'appuser'@'localhost' IDENTIFIED BY 'SuperStrongPassword!';\nCREATE DATABASE appdb;\nGRANT ALL PRIVILEGES ON appdb.* TO 'appuser'@'localhost';\nFLUSH PRIVILEGES;\nEXIT;\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"5-test-access\"><strong>5) Test Access<\/strong><\/h2>\n\n\n\n<p>Visit http:\/\/your-domain\/phpmyadmin or http:\/\/server-ip\/phpmyadmin. If you\u2019ll expose it publicly, secure it with HTTPS and access restrictions before going live.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"install-phpmyadmin-on-ubuntu-debian-nginx-plus-php-fpm\"><strong>Install phpMyAdmin on Ubuntu\/Debian (Nginx + PHP-FPM)<\/strong><\/h2>\n\n\n\n<p>Nginx does not auto-configure phpMyAdmin. You\u2019ll install the package and then create a location block or a symlink to expose it under your site\u2019s root.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"1-install-lemp-packages\"><strong>1) Install LEMP Packages<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt install -y nginx mysql-server php-fpm \\\n  php-mysql php-json php-mbstring php-xml php-curl php-zip php-gd unzip\nsudo systemctl enable --now nginx mysql php*-fpm\nsudo mysql_secure_installation\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"2-install-phpmyadmin-and-add-a-symlink\"><strong>2) Install phpMyAdmin and Add a Symlink<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install -y phpmyadmin\nsudo ln -s \/usr\/share\/phpmyadmin \/var\/www\/html\/phpmyadmin\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"3-configure-nginx-server-block\"><strong>3) Configure Nginx Server Block<\/strong><\/h2>\n\n\n\n<p>Update your site\u2019s server block to pass PHP files to PHP-FPM. Replace the PHP socket path with the one installed on your system (e.g., \/run\/php\/php8.2-fpm.sock).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/nginx\/sites-available\/default\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>server {\n    listen 80;\n    server_name example.com www.example.com;\n    root \/var\/www\/html;\n    index index.php index.html;\n\n    location \/phpmyadmin {\n        alias \/usr\/share\/phpmyadmin\/;\n        index index.php;\n    }\n\n    location ~ ^\/phpmyadmin\/(.+\\.php)$ {\n        alias \/usr\/share\/phpmyadmin\/;\n        include snippets\/fastcgi-php.conf;\n        fastcgi_pass unix:\/run\/php\/php8.2-fpm.sock;\n    }\n\n    location ~* ^\/phpmyadmin\/(.+\\.(?:css|js|png|jpg|gif|ico|html|svg))$ {\n        alias \/usr\/share\/phpmyadmin\/;\n    }\n\n    location ~ \\.php$ {\n        include snippets\/fastcgi-php.conf;\n        fastcgi_pass unix:\/run\/php\/php8.2-fpm.sock;\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>Test and reload Nginx:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nginx -t &amp;&amp; sudo systemctl reload nginx\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"install-phpmyadmin-on-rhel-centos-almalinux-rocky-apache\"><strong>Install phpMyAdmin on RHEL\/CentOS\/AlmaLinux\/Rocky (Apache)<\/strong><\/h2>\n\n\n\n<p>On RHEL-family distributions, phpMyAdmin is provided via EPEL. Install EPEL, then phpMyAdmin, and adjust Apache configuration and SELinux if necessary.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"1-enable-repositories-and-install-lamp\"><strong>1) Enable Repositories and Install LAMP<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install -y epel-release\nsudo dnf install -y httpd mariadb-server php php-mysqlnd php-json php-mbstring php-xml php-gd php-zip\nsudo systemctl enable --now httpd mariadb\nsudo mysql_secure_installation\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"2-install-phpmyadmin\"><strong>2) Install phpMyAdmin<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install -y phpMyAdmin\n<\/code><\/pre>\n\n\n\n<p>This creates \/etc\/httpd\/conf.d\/phpMyAdmin.conf with a default alias, typically restricting access to localhost. Edit to allow your IPs and secure it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/httpd\/conf.d\/phpMyAdmin.conf\n<\/code><\/pre>\n\n\n\n<p>Inside the Directory or Location block, you might see Require local. Replace with a safe allowlist, Basic Auth, or both (see security section below). Then reload Apache:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl reload httpd\n<\/code><\/pre>\n\n\n\n<p>If your MySQL\/MariaDB server is remote, and SELinux is enforcing, allow Apache to connect to DB over the network:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo setsebool -P httpd_can_network_connect_db 1\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"secure-phpmyadmin-must-do\"><strong>Secure phpMyAdmin (Must-Do)<\/strong><\/h2>\n\n\n\n<p>phpMyAdmin is a common attack target. Harden it before exposing to the internet. Implement multiple layers of defense.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"1-enforce-https-lets-encrypt\"><strong>1) Enforce HTTPS (Let\u2019s Encrypt)<\/strong><\/h2>\n\n\n\n<p>Use free <a href=\"https:\/\/www.youstable.com\/blog\/activate-an-ssl-certificate\/\">SSL certificates<\/a> from Let\u2019s Encrypt. <a href=\"https:\/\/www.youstable.com\/blog\/redirect-http-to-https-using-htaccess\/\">Redirect all HTTP<\/a> traffic to HTTPS.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Apache (Ubuntu\/Debian)\nsudo apt install -y certbot python3-certbot-apache\nsudo certbot --apache -d example.com -d www.example.com\n\n# Nginx (Ubuntu\/Debian)\nsudo apt install -y certbot python3-certbot-nginx\nsudo certbot --nginx -d example.com -d www.example.com\n\n# RHEL family (Apache)\nsudo dnf install -y certbot python3-certbot-apache\nsudo certbot --apache -d example.com -d www.example.com\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"2-restrict-by-ip-allowlist\"><strong>2) Restrict by IP (Allowlist)<\/strong><\/h2>\n\n\n\n<p>Limit access to trusted IPs only. For Apache:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \/etc\/apache2\/conf-available\/phpmyadmin.conf or \/etc\/httpd\/conf.d\/phpMyAdmin.conf\n&lt;Directory \/usr\/share\/phpmyadmin&gt;\n    Options SymLinksIfOwnerMatch\n    DirectoryIndex index.php\n    Require ip 203.0.113.10 198.51.100.22\n    Require local\n&lt;\/Directory&gt;\n<\/code><\/pre>\n\n\n\n<p>For Nginx:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>location \/phpmyadmin {\n    allow 203.0.113.10;\n    allow 198.51.100.22;\n    deny all;\n    alias \/usr\/share\/phpmyadmin\/;\n    index index.php;\n}\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"3-add-http-basic-authentication\"><strong>3) Add HTTP Basic Authentication<\/strong><\/h2>\n\n\n\n<p>Prompt for a second set of credentials before reaching phpMyAdmin.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Apache\nsudo htpasswd -c \/etc\/phpmyadmin\/.htpasswd admin\nsudo nano \/etc\/apache2\/conf-available\/phpmyadmin.conf\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;Directory \/usr\/share\/phpmyadmin&gt;\n    AuthType Basic\n    AuthName \"Restricted phpMyAdmin\"\n    AuthUserFile \/etc\/phpmyadmin\/.htpasswd\n    Require valid-user\n&lt;\/Directory&gt;\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># Nginx\nsudo apt install -y apache2-utils\nsudo htpasswd -c \/etc\/nginx\/.htpasswd admin\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>location \/phpmyadmin {\n    auth_basic \"Restricted phpMyAdmin\";\n    auth_basic_user_file \/etc\/nginx\/.htpasswd;\n    alias \/usr\/share\/phpmyadmin\/;\n    index index.php;\n}\n<\/code><\/pre>\n\n\n\n<p>Reload your web server after changes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"4-change-the-default-url-security-by-obscurity-optional\"><strong>4) Change the Default URL (Security by Obscurity, Optional)<\/strong><\/h2>\n\n\n\n<p>Move from \/phpmyadmin to a non-guessable alias (e.g., \/dbadmin-9f27). For Apache, edit the Alias in phpMyAdmin.conf. For Nginx, change the location path. This doesn\u2019t replace real security, but reduces automated scans.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"5-disable-root-login-and-use-least-privilege\"><strong>5) Disable Root Login and Use Least Privilege<\/strong><\/h2>\n\n\n\n<p>Never use root in phpMyAdmin. Create project-specific DB users with only needed privileges. Rotate credentials regularly and apply strong password policy.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"6-keep-software-updated\"><strong>6) Keep Software Updated<\/strong><\/h2>\n\n\n\n<p>Update the OS, PHP, web server, MySQL\/MariaDB, and phpMyAdmin. Subscribe to security advisories. On Debian\/Ubuntu, consider unattended-upgrades for security patches.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"7-firewall-and-fail2ban\"><strong>7) Firewall and Fail2ban<\/strong><\/h2>\n\n\n\n<p>Use UFW\/firewalld to allow only 80\/443 and SSH. Optionally protect phpMyAdmin with Fail2ban custom jails to block brute-force attempts.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"optional-tune-php-and-upload-limits\"><strong>Optional: Tune PHP and Upload Limits<\/strong><\/h2>\n\n\n\n<p>If imports fail due to size or timeouts, adjust <a href=\"https:\/\/www.youstable.com\/blog\/how-to-modify-php-limits-in-directadmin-cpanel\/\">PHP limits<\/a> and restart services.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/php\/8.2\/apache2\/php.ini   # Apache\n# or\nsudo nano \/etc\/php\/8.2\/fpm\/php.ini       # PHP-FPM (Nginx)\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>upload_max_filesize = 256M\npost_max_size = 256M\nmax_execution_time = 300\nmemory_limit = 512M\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># Apply changes\nsudo systemctl reload apache2\n# or\nsudo systemctl reload php8.2-fpm\nsudo systemctl reload nginx\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"troubleshooting-common-issues\"><strong>Troubleshooting Common Issues<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>404 Not Found at \/phpmyadmin: On Nginx, ensure alias and PHP location blocks are correct and that the symlink exists. Reload Nginx.<\/li>\n\n\n\n<li>403 Forbidden: Your IP may be blocked by access rules. Adjust Require\/allow directives accordingly.<\/li>\n\n\n\n<li>Missing mcrypt\/mbstring errors: Install and enable PHP extensions (mbstring, json, xml, curl, zip). Reload web server.<\/li>\n\n\n\n<li>Incorrect CSRF token: Set a proper blowfish secret and clear browser cookies. Ensure session.save_path is writable for PHP.<\/li>\n\n\n\n<li>MySQL\/MariaDB authentication issues: Verify host matches, user has privileges, and password is correct. Check for unix_socket auth on Ubuntu which may bypass passwords; create a native password user if needed.<\/li>\n\n\n\n<li>SELinux denials: For RHEL-family distros, review audit logs and use setsebool\/semanage to allow required contexts and DB connectivity.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"alternative-run-phpmyadmin-with-docker\"><strong>Alternative: Run phpMyAdmin with Docker<\/strong><\/h2>\n\n\n\n<p>Containerizing phpMyAdmin simplifies updates and isolation. Map it to your DB host and expose only via HTTPS behind a reverse proxy.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run -d --name myadmin \\\n  -e PMA_HOST=127.0.0.1 \\\n  -e PMA_ABSOLUTE_URI=https:\/\/dbadmin.example.com\/ \\\n  -p 8080:80 \\\n  --restart unless-stopped \\\n  phpmyadmin\/phpmyadmin:latest\n<\/code><\/pre>\n\n\n\n<p>Place it behind Nginx\/Traefik\/Caddy with TLS and IP\/Basic Auth restrictions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"performance-and-best-practices\"><strong>Performance and Best Practices<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Expose phpMyAdmin only when needed; disable or unpublish it when not in use.<\/li>\n\n\n\n<li>Keep DB backups separate; phpMyAdmin is convenient but not a substitute for automated, offsite backups.<\/li>\n\n\n\n<li>Limit privileges and separate dev\/stage\/prod <a href=\"https:\/\/www.youstable.com\/blog\/change-a-database-user-password\/\">users and databases<\/a>.<\/li>\n\n\n\n<li>Monitor access logs for suspicious patterns.<\/li>\n\n\n\n<li>Use strong TLS ciphers and modern protocols; <a href=\"https:\/\/www.youstable.com\/blog\/redirect-http-to-https\/\">redirect HTTP<\/a> to HTTPS.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"soft-recommendation-let-youstable-handle-it\"><strong>Soft Recommendation: Let YouStable Handle It<\/strong><\/h2>\n\n\n\n<p>If you\u2019d rather avoid the overhead, YouStable\u2019s managed VPS and dedicated servers come with production-grade security hardening, LAMP\/LEMP stacks, and optional phpMyAdmin pre-configured behind HTTPS with access control. Our team can migrate your databases, set least-privileged users, automate backups, and maintain patches\u2014so you can focus on your application.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"step-by-step-recap\"><strong>Step-by-Step Recap<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Install LAMP\/LEMP and phpMyAdmin<\/li>\n\n\n\n<li>Configure Apache\/Nginx alias or server block<\/li>\n\n\n\n<li>Set phpMyAdmin blowfish secret<\/li>\n\n\n\n<li>Create least-privileged DB users<\/li>\n\n\n\n<li>Enforce HTTPS, IP allowlist, and Basic Auth<\/li>\n\n\n\n<li>Adjust PHP limits if needed<\/li>\n\n\n\n<li>Update regularly and monitor logs<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"faqs-setup-phpmyadmin-on-linux-server\"><strong>FAQs: Setup phpMyAdmin on Linux Server<\/strong><\/h2>\n\n\n<div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-1765456957599\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"how-do-i-install-phpmyadmin-on-ubuntu-22-04-24-04\"><strong>How do I install phpMyAdmin on Ubuntu 22.04\/24.04?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Run apt install phpmyadmin after installing Apache (or Nginx) and PHP. On Apache, the installer adds the alias automatically. On Nginx, add an alias\/location block and pass PHP to PHP-FPM. Secure with HTTPS, IP allowlist, Basic Auth, and a blowfish secret.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765456971302\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"how-can-i-access-phpmyadmin-remotely-and-safely\"><strong>How can I access phpMyAdmin remotely and safely?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Use HTTPS with a valid certificate, restrict by IP, and enable HTTP Basic Auth. Consider placing phpMyAdmin behind a VPN or SSH tunnel for admin-only access. Avoid exposing it to the open internet when possible.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765456977365\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"is-phpmyadmin-secure-for-production\"><strong>Is phpMyAdmin secure for production?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Yes, when hardened: keep software updated, enforce TLS, use IP allowlists and Basic Auth, disable root login, use strong passwords, set a blowfish secret, and monitor logs. Security-by-default is essential because phpMyAdmin is a frequent target.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765456991978\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"how-do-i-change-the-phpmyadmin-url-from-phpmyadmin\"><strong>How do I change the phpMyAdmin URL from \/phpmyadmin?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>In Apache, edit the Alias in phpMyAdmin.conf to something like \/dbadmin-unique and reload Apache. In Nginx, change the location path accordingly and reload Nginx. This adds mild obscurity; still use IP restrictions and Basic Auth.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765457000462\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"why-do-i-get-incorrect-csrf-token-in-phpmyadmin\"><strong>Why do I get \u201cIncorrect CSRF token\u201d in phpMyAdmin?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Usually due to a missing\/weak blowfish secret or session issues. Set a strong $cfg[&#8216;blowfish_secret&#8217;] in \/etc\/phpmyadmin\/config.inc.php, clear cookies, and ensure PHP sessions are writable (check session.save_path). Reload your web server after changes.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765457012166\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"what-port-does-phpmyadmin-use\"><strong>What port does phpMyAdmin use?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>phpMyAdmin runs over your web server\u2019s HTTP\/HTTPS ports\u2014typically 80 and 443. It does not open a separate port. Secure it with TLS and access controls if exposed publicly.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765457028674\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"how-do-i-uninstall-phpmyadmin\"><strong>How do I uninstall phpMyAdmin?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>On Ubuntu\/Debian: sudo apt remove phpmyadmin (or apt purge phpmyadmin to remove configs). On RHEL family: sudo dnf remove phpMyAdmin. Remove any Nginx\/Apache aliases and reload the web server.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"final-thoughts\"><strong>Final Thoughts<\/strong><\/h2>\n\n\n\n<p>With the steps above, you can install and harden phpMyAdmin on any popular Linux distribution. Keep it behind HTTPS, restrict access, and use minimum privileges. If you prefer a hands-off approach, YouStable can provision and maintain a secure, optimized stack with phpMyAdmin ready for production.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To set up phpMyAdmin on a Linux server, install a LAMP or LEMP stack, add the phpMyAdmin package via your [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":15444,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[350],"tags":[],"class_list":["post-12243","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-knowledgebase"],"acf":[],"featured_image_src":"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2025\/12\/How-to-Setup-phpMyAdmin-on-Linux-Server.jpg","author_info":{"display_name":"Prahlad Prajapati","author_link":"https:\/\/www.youstable.com\/blog\/author\/prahladblog"},"_links":{"self":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/12243","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/comments?post=12243"}],"version-history":[{"count":5,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/12243\/revisions"}],"predecessor-version":[{"id":15445,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/12243\/revisions\/15445"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/media\/15444"}],"wp:attachment":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/media?parent=12243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/categories?post=12243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/tags?post=12243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}