How to Install phpMyAdmin on CentOS
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.gzThe 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 /tmpExtract it:
tar -xzf phpMyAdmin-*.tar.gzThis will create a directory similar to:
phpMyAdmin-x.x.x-all-languages3. 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/phpmyadminThe directory structure will become:
/var/www/irhamdinata.id/public/
├── index.php
├── ...
└── phpmyadmin/
├── index.php
├── libraries/
├── setup/
└── ...The folder is renamed to:
phpmyadminThis means phpMyAdmin can be accessed through:
http://irhamdinata.id/phpmyadmin4. Set the Correct Permissions
Make sure Apache can access the phpMyAdmin files:
sudo chown -R apache:apache /var/www/irhamdinata.id/public/phpmyadminThen set appropriate permissions:
sudo chmod -R 755 /var/www/irhamdinata.id/public/phpmyadmin5. 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/phpmyadminCopy the sample configuration:
sudo cp config.sample.inc.php config.inc.phpThen edit it:
sudo nano config.inc.phpFind:
$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/phpmyadminYou 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
rootaccount 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/phpmyadminThen set the permissions:
sudo chown -R apache:apache \
/var/www/irhamdinata.id/public/phpmyadmin
sudo chmod -R 755 \
/var/www/irhamdinata.id/public/phpmyadminAfter that, phpMyAdmin can be accessed through:
http://irhamdinata.id/phpmyadminThis approach allows phpMyAdmin and your Laravel application to run under the same Apache web server.






