用编辑器打开phpMyAdmin的配置文件(路径:/etc/httpd/conf.d/phpMyAdmin.conf)。Find and comment out every line that says "Require ip XXXX". There will be four such lines. Add "Require all granted" instead. The updated configuration file will look like the following.
By default, phpMyAdmin on CentOS 6 blocks access from every IP address. To enable remote access, you will need to update its configuration.
Open phpMyAdmin's configuration (/etc/httpd/conf.d/phpmyadmin.conf) with a text editor. Find a line that says "Deny from all", and comment it out. Then change the line that says "Allow from 127.0.0.1" to "Allow from 0.0.0.0". The updated configuration will look like the following.
$ sudo vi /etc/httpd/conf.d/phpmyadmin.conf
----------
<Directory"/usr/share/phpmyadmin">
Order Deny,Allow
# Deny from all
Allow from 0.0.0.0
</Directory>
The next step is to add a blowfish password to the phpMyAdmin's configuration. This step is needed to encrypt password in cookie as part of cookie-based authentication.
Open the following file with a text editor, and set a random blowfish password as follows.
$ sudo vi /usr/share/phpmyadmin/config.inc.php
----------
$cfg['blowfish_secret'] = 'kd5G}d33aXDc50!'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
Finally, restart httpd to activate the change.
$ sudo service httpd restart
### Test phpMyAdmin ###
To test if phpMyAdmin is successfully set up, go to http://<web-server-ip-addresss>/phpmyadmin
Here are a few troubleshooting tips during phpMyAdmin installation on CentOS.
1. When you are trying to access phpMyAdmin page in web browser, you are getting "403 Forbidding" error with:
You don't have permission to access /phpMyAdmin on this server.
This error is happening because the default setting of phpMyAdmin blocks access from a remote IP address. To fix this error, you need to edit its configuration to allow remote access. See the above for more detail.
2. When you access phpMyAdmin page, you are seeing "The configuration file now needs a secret passphrase (blowfish_secret)." message, and you cannot login.
To fix this error, you need to edit /usr/share/phpmyadmin/config.inc.php to add a random blowfish password as follows, and restart httpd.
$cfg['blowfish_secret'] = 'kd5G}d33aXDc50!'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
----------
$ sudo service httpd restart (CentOS 6)
$ sudo systemctl restart httpd (CentOS 7)
3. When you access phpMyAdmin page, you are getting "Cannot load mcrypt extension. Please check your PHP configuration" error message.
To solve this error, install the following package: