tutorial on installing phpMyAdmin on CentOS

Source: Internet
Author: User
Tags php script require centos phpmyadmin

This article mainly introduces the CentOS on the installation of phpMyAdmin tutorial, phpMyAdmin is a PHP script to operate the MySQL tool, very popular, need friends can refer to the

Premise

Installing phpMyAdmin on CentOS, you first need to set up a Web server (such as Apache or Nginx) to install the MYSQL/MARIADB database and PHP. Depending on your preferences and needs, you can choose an installation from lamp and lemp.

Another requirement is to allow the Epel library to be installed on your centos. If you haven't set it up, poke it in here.

Install phpMyAdmin on CentOS6 or 7

Once you have set up the Epel library, you can easily install phpMyAdmin with the following commands.

On the CentOS 7:

?

1 $ sudo yum install phpMyAdmin

On the CentOS 7:

?

1 $ sudo yum install phpMyAdmin php-mcrypt

Configure phpMyAdmin on CentOS 7

By default, phpMyAdmin on CentOS 7 only allows access from a loopback address (127.0.0.1). In order 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 words "Require IP XXXX". There will be lines of code everywhere, replaced with "Require all granted". The changed configuration file is shown below.

?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 $ 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 Gran Ted </RequireAny> </IfModule> <ifmodule!mod_authz_core.c> # Apache 2.2 order Deny,allow Deny-All A Llow from 127.0.0.1 Allow:: 1 </IfModule> </Directory> <Directory/usr/share/phpMyAdmin/setup/> & Lt;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 order Deny,allow Deny to all Allo W from 127.0.0.1 Allow from:: 1 </IfModule> </Directory> ...

Finally, restart the httpd to make the changes take effect.

?

1 $ sudo systemctl restart httpd

Configure phpMyAdmin on CentOS 6

By default, the phpMyAdmin on CentOS 6 is prohibited from being accessed from each IP address. In order 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 annotate the line of code for the words "Deny from". Then change the line of code for the word "Allow from 127.0.0.1" to "Allow from 0.0.0.0". The changed configuration file is shown below.

?

1 2 3 4 5 6 7 $ sudo vi/etc/httpd/conf.d/phpmyadmin.conf <directory "/usr/share/phpmyadmin" > Order Deny,allow # Deny to all A Llow from 0.0.0.0 </Directory>

The next step is to encrypt the phpMyAdmin configuration file with the Blowfish encryption tool. This step requires encrypting the password in the cookie as part of the authentication based on cookies.

Open the file shown in the following path with a text editor and set a random password with Blowfish, as shown below.

?

1 2 3 $ sudo vi/usr/share/phpmyadmin/config.inc.php $cfg [' blowfish_secret '] = ' kd5g}d33axdc50! '; /* You must the FILL in the for COOKIE auth! */

Finally, restart the httpd to make the changes take effect.

?

1 $ sudo service httpd restart

Test phpMyAdmin

Test whether phpMyAdmin is set up successfully, Access this page: http:// /phpmyadmin

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.