Config phpmyadmin on nginx and look at the database of erpnext

how can I do config phpmyadmin on nginx to take a look at the database of erpnext ?

I refer to this :

and this :
How to Install and Secure phpMyAdmin with Nginx on an Ubuntu 18.04 server | DigitalOcean

and :

i try all of this but not working it return 404 page not found http://site_name/phpmyadmin

I found the solution to config phpmyadmin on nginx

sudo nano /etc/nginx/conf.d/frappe-bench.conf

add this lines:

# phpMyAdmin:
location /phpmyadmin {
    root /usr/share;
    index index.php;
}
# PHP files for phpMyAdmin:
location ~ ^/phpmyadmin(.+\.php)$ {
    root /usr/share;
    index index.php;
    #fastcgi_read_timeout 300;
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/run/php/php8.1-fpm.sock;
}

but I can't login  to phpmyadmin  . it return " Failed to set session cookie. Maybe you are using HTTP instead of HTTPS to access phpMyAdmin".

Hi,

Have you tried clearing your browser cache or a different browser?

Perhaps this rather long thread will have something useful?

yes every time I clear the browser cache

but when I login return => mysqli::real_connect(): (HY000/1698): Access denied for user ‘root’@‘localhost’

I do bench mariadb to create a new user and grant all privileges

ERROR 1227 (42000): Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation

I think that is a different problem, however see if you can SHOW DATABASES look at the grants for users etc after logging in as root.

https://stackoverflow.com/questions/7797543/mysql-error-1227-42000-access-denied-cannot-create-user

Finally it’s working perfectly fine. I add the solution here to help others poeple

For those who are also facing this type of problem

STEP 1:

sudo nano /etc/nginx/conf.d/frappe-bench.conf

add this lines:

    # phpMyAdmin:
     location /phpmyadmin {
       root /usr/share;
       index index.php;
    }
    # PHP files for phpMyAdmin:
    location ~ ^/phpmyadmin(.+\.php)$ {
      root /usr/share;
      index index.php;
      #fastcgi_read_timeout 300;
      include snippets/fastcgi-php.conf;
      fastcgi_pass unix:/run/php/php8.1-fpm.sock;
     }

STEP 2:

    sudo nano /usr/share/phpmyadmin/config.inc.php
 
    set variable in config.inc.php $cfg['PmaAbsoluteUri'] to the url that your user should see

    for example $cfg['PmaAbsoluteUri'] = https://example.com/phpmyadmin

STEP 3:

     create a separate user to connect the phpMyAdmin and manage the database.

     mysql -uroot -p

     password:your_mysql_ROOTPASSWORD

     MariaDB [(none)]> create user admin@localhost identified by 'your_password';

     Next, grant all the privileges to the user with the following command:

     MariaDB [(none)]> grant all privileges on *.* to admin@localhost with grant option;

     Next, flush the privileges and exit from the MariaDB shell using the following command:

    - MariaDB [(none)]> flush privileges;
    - MariaDB [(none)]> exit;

     connect to database mysql and change plugin to mysql_native_password for user

     mysql -uroot -p mysql

     - MariaDB [(mysql)]> update user set plugin ='mysql_native_password' where USER = "root";
    - MariaDB [(mysql)]> flush privileges;
    - MariaDB [(mysql)]> exit;

     visit https://your_domain/phpmyadmin

    login :admin 
    password : your _password  
    and you can show your database and  tables Erpnext
1 Like