phpmyadmin

cd /usr/local/src
wget https://files.phpmyadmin.net/phpMyAdmin/4.8.2/phpMyAdmin-4.8.2-all-languages.zip
unzip phpMyAdmin-4.8.2-all-languages.zip
mkdir /usr/serverok
rm -rf /usr/serverok/phpmyadmin
mv phpMyAdmin-4.8.2-all-languages /usr/serverok/phpmyadmin
mkdir /usr/serverok/phpmyadmin/tmp/
chmod 777 /usr/serverok/phpmyadmin/tmp/
cp /usr/serverok/phpmyadmin/config.sample.inc.php /usr/serverok/phpmyadmin/config.inc.php

Edit

vi /usr/serverok/phpmyadmin/config.inc.php

Generate 32 chars length random key and add

pwgen 32

Or

sed -i  's/$cfg\[.blowfish_secret.\] = .*$/$cfg\["blowfish_secret"\] = "ohhae8Fa6oJohrohng0ieV0to3aiThae";/g' /usr/serverok/phpmyadmin/config.inc.php

Configure Apache

On Ubuntu, create file

vi /etc/apache2/conf-enabled/phpmyadmin.conf

On CentOS

vi /etc/httpd/conf.d/phpmyadmin.conf

Add following content

Alias /phpmyadmin "/usr/serverok/phpmyadmin"
  

    AllowOverride All
    Options FollowSymlinks
    Order allow,deny
    Allow from all
   
     
       Require all granted
     
   

MySQL root can’t login to phpMyAdmin

Password Protect phpMyAdmin in CentOS Server

Add following config to /etc/httpd/conf.d/phpmyadmin.conf

alias /phpmyadmin "/usr/serverok/phpmyadmin"


    AllowOverride All
    Options FollowSymlinks
    AuthType Basic
    AuthName "Restricted Content"
    AuthUserFile /usr/serverok/htpasswd/phpmyadmin
    Require valid-user

Create password file

mkdir /usr/serverok/htpasswd
htpasswd -c /usr/serverok/htpasswd/phpmyadmin admin

This will create user “admin” with password you specified.

Restart apache

service httpd restart

Nginx

Add following inside any server entry

location /phpmyadmin {
    root /usr/serverok/;
    index index.php;
    location ~ ^/phpmyadmin/(.*\.php)$ {
            include snippets/fastcgi-php.conf;
            proxy_read_timeout 180;
            fastcgi_intercept_errors on;
            fastcgi_buffers 16 16k;
            fastcgi_buffer_size 32k;
            fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    }
}

https://www.adminer.org
phpMyAdmin allow connecting to multiple servers
Allow phpMyAdmin remote access on xampp
MySQL root can’t login to phpMyAdmin
Nginx Configuration for phpMyAdmin

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *