Sitemap

How to Install phpMyAdmin on CentOS

2 min readSep 7, 2026

--

phpMyAdmin is a web-based interface that makes it easier to manage MySQL or MariaDB databases.

In this tutorial, we will install phpMyAdmin manually and make it accessible through the web server.

1. Download phpMyAdmin

Go to the official phpMyAdmin download page:

Download the .tar.gz package.

For example:

phpMyAdmin-x.x.x-all-languages.tar.gz

The exact version may be different depending on the latest release.

2. Extract phpMyAdmin

Upload the downloaded archive to your server.

For example, if the file is located in /tmp:

cd /tmp

Extract it:

tar -xzf phpMyAdmin-*.tar.gz

This will create a directory similar to:

phpMyAdmin-x.x.x-all-languages

3. Move phpMyAdmin to the Web Root

If you want phpMyAdmin to be accessible from the same Laravel domain, you can place it inside the web root.

For example:

sudo mv phpMyAdmin-*-all-languages /var/www/irhamdinata.id/public/phpmyadmin

The directory structure will become:

/var/www/irhamdinata.id/public/
├── index.php
├── ...
└── phpmyadmin/
├── index.php
├── libraries/
├── setup/
└── ...

The folder is renamed to:

phpmyadmin

This means phpMyAdmin can be accessed through:

http://irhamdinata.id/phpmyadmin

4. Set the Correct Permissions

Make sure Apache can access the phpMyAdmin files:

sudo chown -R apache:apache /var/www/irhamdinata.id/public/phpmyadmin

Then set appropriate permissions:

sudo chmod -R 755 /var/www/irhamdinata.id/public/phpmyadmin

5. Configure phpMyAdmin

For newer phpMyAdmin versions, you may need to create a configuration file.

Get Irham Dinata’s stories in your inbox

Join Medium for free to get updates from this writer.

Navigate to the phpMyAdmin directory:

cd /var/www/irhamdinata.id/public/phpmyadmin

Copy the sample configuration:

sudo cp config.sample.inc.php config.inc.php

Then edit it:

sudo nano config.inc.php

Find:

$cfg['blowfish_secret'] = '';

Set a random secret string:

$cfg['blowfish_secret'] = 'your-random-secret-string';

The secret should be sufficiently long and random.

6. Access phpMyAdmin

Open your browser and visit:

http://irhamdinata.id/phpmyadmin

You should see the phpMyAdmin login page.

Enter your MySQL username and password to log in.

Security Considerations

Because phpMyAdmin provides direct access to your database, exposing it publicly should be done carefully.

At minimum:

  • Use HTTPS.
  • Use a strong MySQL password.
  • Keep phpMyAdmin updated.
  • Avoid using the MySQL root account for normal application tasks.
  • Consider restricting access to phpMyAdmin by IP or using additional authentication.
  • Do not expose phpMyAdmin unnecessarily on production servers.

If possible, using a less predictable URL or restricting access through your firewall or Apache configuration can provide an additional layer of protection.

Conclusion

The basic installation process is:

cd /tmp
tar -xzf phpMyAdmin-*.tar.gz
sudo mv phpMyAdmin-*-all-languages \
/var/www/irhamdinata.id/public/phpmyadmin

Then set the permissions:

sudo chown -R apache:apache \
/var/www/irhamdinata.id/public/phpmyadmin
sudo chmod -R 755 \
/var/www/irhamdinata.id/public/phpmyadmin

After that, phpMyAdmin can be accessed through:

http://irhamdinata.id/phpmyadmin

This approach allows phpMyAdmin and your Laravel application to run under the same Apache web server.

--

--