problem: I am running a mysql/mariadb service on CentOS, and I want to use phpMyAdmin to manage the database through the network interface. What is the best way to install phpMyAdmin on CentOS?
phpMyAdmin is a PHP-based, Web MYSQL/MARIADB database management tool. Although there are already some lightweight database management tools such as Adminer, phpMyAdmin is more widely used by webmasters to perform various mysql/mariadb management tasks. It supports almost all MySQL database/table related operations, such as browse, create, copy, delete, rename, change, and MySQL user/Rights Management and database import/export. Here's how to install phpMyAdmin on CentOS 6 or 7.
Premise
To install phpMyAdmin on CentOS, you first need to set up a Web server (such as Apache or Nginx), install the MYSQL/MARIADB database and PHP. Depending on your preferences and needs, you can choose an installation from lamp and lemp.
CentOS 6.5 installation configuration lamp http://www.linuxidc.com/Linux/2014-07/104373.htm
Ubuntu 13.04 installation lamp\vsftpd\webmin\phpmyadmin services and Settings http://www.linuxidc.com/Linux/2013-06/86250.htm
CentOS 5.9 under Compile and install lamp (Apache 2.2.44+mysql 5.6.10+php 5.4.12) http://www.linuxidc.com/Linux/2013-03/80333p3.htm
RedHat 5.4 Under the Web server architecture source code construction Lamp Environment and application Phpwind http://www.linuxidc.com/Linux/2012-10/72484p2.htm
Lamp source Environment Build Web server linux+apache+mysql+php http://www.linuxidc.com/Linux/2013-05/84882.htm
Lamp optimization and reinforcement http://www.linuxidc.com/Linux/2014-07/104092.htm based on Ubuntu
Another requirement is to allow the Epel library to be installed on your centos. If you haven't set it up, please poke here.
Install the phpMyAdmin on CentOS6 or 7
Once you have set up the Epel library, you can easily install phpMyAdmin with the following command.
On CentOS 7:
- $ sudo yum install phpMyAdmin
On CentOS 7:
- $ sudo yum install phpmyadmin php-mcrypt
Configuring phpMyAdmin on CentOS 7
By default, phpMyAdmin on CentOS 7 only allows access from the loopback address (127.0.0.1). In order to be able to connect remotely, you need to change its configuration.
Open the PhpMyAdmin configuration file (path:/etc/httpd/conf.d/phpmyadmin.conf) with a text editor and locate and comment out the line of code with the word "Require IP XXXX". There will be lines of code like this, with "Require all granted" instead. The re-altered configuration file is shown below.
- $ sudo vi /etc/httpd/conf. D/phpMyAdmin. conf
- . . . . .
- <Directory/usr/share/phpMyAdmin/>
- Adddefaultcharset UTF-8
- <ifmodule mod_authz_core. C>
- # Apache 2.4
- <requireany>
- #Require IP 127.0.0.1
- #Require IP:: 1
- Require all granted
- </requireany>
- </ifmodule>
- <ifmodule! Mod_authz_core. C>
- # Apache 2.2
- OrderDeny, allow
- Denyfrom all
- Allowfrom127.0. 0.1
- Allowfrom::1
- </ifmodule>
- </Directory>
- <Directory/usr/share/phpMyAdmin/setup/>
- <ifmodule mod_authz_core. C>
- # Apache 2.4
- <requireany>
- #Require IP 127.0.0.1
- #Require IP:: 1
- Require all granted
- </requireany>
- </ifmodule>
- <ifmodule! Mod_authz_core. C>
- # Apache 2.2
- OrderDeny, allow
- Denyfrom all
- Allowfrom127.0. 0.1
- Allowfrom::1
- </ifmodule>
- </Directory>
- . . . . .
Finally, restart the httpd for the changes to take effect.
- $ sudo systemctl restart httpd
Configuring phpMyAdmin on CentOS 6
By default, phpMyAdmin on CentOS 6 is prohibited from accessing from each IP address. In order to be able to connect remotely, you need to change its configuration.
Open the PhpMyAdmin configuration file (path:/etc/httpd/conf.d/phpmyadmin.conf) with a text editor and locate and comment out the line of code for the word "Deny from all". Then change the line of code "allow from 127.0.0.1" to "Allow from 0.0.0.0". The re-altered configuration file is shown below.
- $ 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 encrypt the phpMyAdmin configuration file with the Blowfish encryption tool. This step requires the password in the encrypted cookie to be part of the cookie-based authentication.
Open the file shown in the following path with a text editor and set a random password with Blowfish, as shown below.
- $ sudo vi /usr/share/phpmyadmin/config. Inc. PHP
- $cfg[' Blowfish_secret ']=' kd5g}d33axdc50! ' ; / * must FILL in the This for COOKIE auth! */
Finally, restart the httpd for the changes to take effect.
- $ sudo service httpd restart
Test phpMyAdmin
To test whether the phpMyAdmin is set successfully, visit this page: Http://<web-server-ip-addresss>/phpmyadmin
You should be able to record any MySQL user (such as root) and manage MYSQL/MARIADB database/table through the Web interface.
Troubleshooting
Here are some of the problem solving methods that are encountered during installation of phpMyAdmin on CentOS.
When you try to connect the phpMyAdmin page in your browser, you see "403 Forbidding" error:
You don't have permission to access/phpmyadmin on this server.
This error occurs because the IP address remote connection is blocked by the phpMyAdmin by default. To fix this error, you need to edit its configuration file to allow remote connections. See above for specific operation.
When you connect the phpMyAdmin page, you see "The configuration file now needs a secret passphrase (Blowfish_secret)." Information, and you cannot log in.
To fix this error, you need to edit/usr/share/phpmyadmin/config.inc.php this file to add a random blowfish password, and then restart httpd as shown below.
- $cfg[' Blowfish_secret ']=' kd5g}d33axdc50! ' ; / * must FILL in the This for COOKIE auth! */
- $ sudo service httpd restart (CentOS6)
- $ sudo systemctl restart httpd (CentOS7)
When you connect the phpMyAdmin page, you see "Cannot load mcrypt extension. Please check your PHP configuration "error message.
To fix this error, install the following package:
- $ sudo yum install php-mcrypt
Then restart HTTPD:
- $ sudo service httpd restart (CentOS6)
- $ sudo systemctl restart httpd (CentOS7)
Example of the cooperative application of lamp architecture--phpmyadmin http://www.linuxidc.com/Linux/2013-07/87645.htm
Lamp application of phpMyAdmin, Wordpress http://www.linuxidc.com/Linux/2013-04/82757.htm
phpMyAdmin Old Login time-out workaround http://www.linuxidc.com/Linux/2012-09/70715.htm
Ubuntu installation phpMyAdmin and Adminer http://www.linuxidc.com/Linux/2012-08/69419.htm
SSL functionality is implemented on lamp basis and phpMyAdmin http://www.linuxidc.com/Linux/2012-07/66905.htm is installed
Ubuntu 14.04 configuration Lamp+phpmyadmin PHP (5.5.9) Development environment Http://www.linuxidc.com/Linux/2014-10/107924.htm
phpMyAdmin Details : please click here
phpMyAdmin : please click here.
For more information on CentOS, see the CentOS feature page http://www.linuxidc.com/topicnews.aspx?tid=14
This article permanently updates the link address : http://www.linuxidc.com/Linux/2014-12/110847.htm
Getting Started with Linux systems: Installing phpMyAdmin on CentOS