Tag: phpmyadmin

  • 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

  • MySQL root can’t login to phpMyAdmin

    On Debian/Ubuntu MySQL root user can only login using socket. This is done with Plugin.

    MariaDB [(none)]> select User, Plugin from mysql.user;
    +-----------+-------------+
    | User      | Plugin      |
    +-----------+-------------+
    | root      | unix_socket |
    | sserverok |             |
    +-----------+-------------+
    2 rows in set (0.00 sec)
    
    MariaDB [(none)]> 
    

    To fix this, first set a password for user root.

    Change MySQL root password

    To disable plugin, run following commands in MySQL command prompt as user root.

    update mysql.user set Plugin='' where User="root";
    flush privileges;
    

    MySQL
    phpMyAdmin

  • Debian Allow MySQL root user to login using phpMyAdmin

    On Debian/Ubuntu by default MySQL root user can only login from local accounts.

    MariaDB [(none)]> select plugin from mysql.user where user='root';
    +-------------+
    | plugin      |
    +-------------+
    | unix_socket |
    +-------------+
    1 row in set (0.00 sec)
    
    MariaDB [(none)]> 
    

    To enable login from phpMyAdmin, you need to set plugin to “mysql_native_password”.

    To do this, login to MySQL as user root, then run

    update mysql.user set plugin='mysql_native_password' where user='root';