• Home
  • WordPress
  • web Hosting
  • linux
  • mysql
  • nginx
  • apache2
  • devops

Raju Ginni

wordpress tutorials seo hosting etc

You are here: Home / MySQL Tutorial (create,connect database, update tables, export etc) Documentation & TIPS / phpmyadmin install / configure on nginx ubuntu 20.04 apache2 debian 10

phpmyadmin install / configure on nginx ubuntu 20.04 apache2 debian 10

 

 

 

Table of Contents

Toggle
    • Installing PHPMyAdmin on nginx ubuntu
  • install with 1 command
  • default configuration for lighttpd and apache
  • Configure database for phpmyadmin with dbconfig-common?
  • Enter mysql password if you chose yes for DB Config
    • Configuring NGINX to Serve PhpMyAdmin Site
  • reload restart nginx web server
  • Test Phpmyadmin installation
  • Secure phpmyadmin installation – step 2.1
  • or basic step 2.1 phpmyadmin nginx configuration
  • Step 3
    • Create symbolic link
  • part 3 nginx server block for phpmyadmin
    • Securing phpmyadmin login page
    • 2nd & easy way to configure phpmyadmin var/www/html nginx
  • install phpmyadmin apache2 Debian
  • troubleshooting
    • Database export & import using Phpmyadmin
    • Drop / deleting a database in Phpmyadmin
    • Copying database in Phpmyadmin
    • Configuring Password Access for the MySQL Root Account
  • FInd replace in mysql phpmyadmin

Installing PHPMyAdmin on nginx ubuntu

 

First command to update ubuntu or Debian

 

  1. install with 1 command

sudo apt-get update

sudo apt-get install phpmyadmin

 

While installation

default configuration for lighttpd and apache

phpmyadmin-install on ubutu nginx part 2

press tab to leave. or

Press Esc because NGINX is not on the list provided.

 

Configure database for phpmyadmin with dbconfig-common?

PhpMyAdmin requires a database to work with. In this package configuration prompt, choose Yes

 

dbconfig-common package

phpmyadmin-install on ubutu nginx

│ <Yes> <No>

 

Enter mysql password if you chose yes for DB Config

create-a-password-for-phpmyadmin-to-register-with-mysql

Configuring NGINX to Serve PhpMyAdmin Site

 

sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

optiona1 security

sudo ln -s /usr/share/phpmyadmin /var/www/html/secretword

$ sudo chmod 775 -R /usr/share/phpmyadmin/
$ sudo chown root:www-data -R /usr/share/phpmyadmin/

 

 

reload restart nginx web server

sudo systemctl restart nginx

or

nginx  -s reload

 

Test Phpmyadmin installation

serverip/phpmyadmin

 

 

sudo phpenmod mcrypt

WARNING: Module mcrypt ini file doesn’t exist under /etc/php/7.1/mods-available

sudo apt install php7.1-mcrypt && sudo apt install php7.1-mbstring

Setting up php7.1-mcrypt (7.1.9-1+ubuntu16.04.1+deb.sury.org+1) …
Creating config file /etc/php/7.1/mods-available/mcrypt.ini with new version
php7.1-mbstring is already the newest version

 

sudo a2enmod mcrypt
ERROR: Module mcrypt does not exist!

sudo ln -s /etc/php/7.1/conf.d/mcrypt.ini /etc/php/7.1/mods-available/mcrypt.ini

failed to create symbolic link ‘/etc/php/7.1/mods-available/mcrypt.ini’: Fil e exists

 

Then enable them with:
sudo a2enmod mcrypt
sudo a2enmod mbstring

sudo service php7.4-fpm restart

 

Secure phpmyadmin installation – step 2.1

 

sudo ln -s /usr/share/phpmyadmin /var/www/html/secret

sudo nano /etc/nginx/snippets/phpmyadmin.conf

location /secret {
root /var/www/html;
index index.php;
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?$args;

location ~ ^/secret/(doc|sql|setup)/ {
deny all;
}

location ~ /secret/(.+\.php)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;

}
}

or basic step 2.1 phpmyadmin nginx configuration

sudo nano /etc/nginx/snippets/phpmyadmin.conf

location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}

location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}

Step 3

include snippets/phpmyadmin.conf;

 

include snippets/phpmyadmin.conf;

include snippets/sqlc.conf;

phmyadmin install sucessful

 

 

errors may occurs

[error] 2562720#2562720: *24086422 open() “/usr/share/phpmyadmin/sqlc” failed (2: No such file or directory), client: 103.228.33.114, server: rajugi2ne.com, request: “GET /sqlc HTTP/1.1”, host: “194.195.113.187”
2021/12/31 13:03:52 [notice] 2562770#2562770: signal process started

in default server block or any domain.

 

sudo apt-get install php7.4-mbstring

 

phpmyadmin location in ubnutu

/usr/share/phpmyadmin

 

Create symbolic link

sudo ln -s /usr/share/phpmyadmin /usr/share/nginx/html

or

sudo ln -s /usr/share/phpmyadmin /var/www/html/secret

 

Assign www user to & file permission

$ sudo chmod 775 -R /usr/share/phpmyadmin/
$ sudo chown root:www-data -R /usr/share/phpmyadmin/

 

cd /usr/share/nginx/html && ls -l

-rw-r–r– 1 root root 612 Jan 31 2017 index.html
lrwxrwxrwx 1 root root 21 Sep 27 06:04 phpMyAdmin -> /usr/share/phpmyadmin

 

 

 

part 3 nginx server block for phpmyadmin

sudo nano /etc/nginx/sites-available/default

 

 

location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}

 

save changes

service nginx restart

or nginx -s reload

 

Securing phpmyadmin login page

 

cd /usr/share/nginx/html && ls -l

-rw-r–r– 1 root root 612 Jan 31 2017 index.html
lrwxrwxrwx 1 root root 21 Sep 27 06:04 phpMyAdmin -> /usr/share/phpmyadmin

renaming phpmyadmin
sudo mv phpmyadmin Desired Name

or

sudo ln -s /usr/share/phpmyadmin /var/www/html/secret

 

next add root location for server block.

server block

 

modify

Addthis

Htaccess password in nginx using crypt()

 

Look at digital ocean

Youtube video tutorial 

 

2nd & easy way to configure phpmyadmin var/www/html nginx

install phpmyadmin

symlic phpmyadmin folder to var/www/html

add server block to /var/www/html

access phpmyadmin page from browser.

filepermission & owner is optional.

install phpmyadmin apache2 Debian

sudo apt-get install phpmyadmin

 

two alerts

1 configure DB or not

install apache  Lighttpd  (select apache).

 

 

[php7:error] [pid 7626] [client 123.201.77.106:10105] PHP Fatal error: Uncaught Error: Call to undefined function __() in /usr/share/phpmyadmin/libraries/core.lib.php:235\nStack trace:\n#0 /usr/share/phpmyadmin/libraries/core.lib.php(308): PMA_fatalError(‘The [a@./url.ph…’)\n#1 /usr/share/phpmyadmin/libraries/common.inc.php(90): PMA_warnMissingExtension(‘mbstring’, true)\n#2 /usr/share/phpmyadmin/index.php(12): require_once(‘/usr/share/phpm…’)\n#3 {main}\n thrown in /usr/share/phpmyadmin/libraries/core.lib.php on line 235

500 internal server occurrs

 

if

then go /var/log/apache2/error.log

sudo apt-get install php-mbstring

sudo service apache2 restart

Then open your ip/phpmyadmin

if not worked then try this

sudo nano /etc/php/7.0/apache2/php.ini

Then uncomment

;extension=php_mbstring.dll   or use this command sudo phpenmod mbstring

 

 

Secure or rename page

 

sudo nano /etc/phpmyadmin/apache.conf

 

Alias /phpmyadmin /usr/share/phpmyadmin  to

Alias /secretword /usr/share/phpmyadmin

 

service apache2 reload

 

now your new phpmyadmin login url is ip/secretword.

 

 

troubleshooting

mysqli_real_connect(): (HY000/1045): Access denied for user ‘phpmyadmin’@’localhost’ (using password: YES)

Create a database named ‘phpmyadmin’ and setup the phpMyAdmin configuration storage there.

no db or no user.

/etc/phpmyadmin/config.inc.php

$cfg[‘Servers’][$i][‘controluser’] = $dbuser;
$cfg[‘Servers’][$i][‘controlpass’] = $dbpass;
/* Optional: Advanced phpMyAdmin features */
$cfg[‘Servers’][$i][‘pmadb’] = $dbname;

/etc/phpmyadmin/config-db.php

 

$dbuser=’phpmyadmin’;
$dbpass=’pass’;
$basepath=”;
$dbname=’phpmyadmin’;
$dbserver=’localhost’;
$dbport=’3306′;
$dbtype=’mysql’;

 

mysql> CREATE USER ‘phpmyadmin’@’%’ IDENTIFIED BY ‘pass’ ;

mysql> CREATE USER ‘p’@’%’ IDENTIFIED BY ‘MyPasswordHere!

mysql> GRANT ALL PRIVILEGES ON *.* TO ‘phpmyadmin’@’%’ WITH GRANT OPTION;

onfiguration of pmadb… not OK

 

 

Database export & import using Phpmyadmin

There is web server limits for phpmyadmin max file upload size and max execution time. so reupload same dump it will continue further.

export database:

just select all tables,

select export and

click on Go.

Drop / deleting a database in Phpmyadmin

 

Select database >> goto >> Operation>>

CLick on Drop Database.

Copying database in Phpmyadmin

 

go to operations >> select copy database to new or existing.

 

Copy tables to another database using in phpmyadmin

 

Select database and go operations and click on copy table to another database.

 

CHange table charset and collation in phpmyadmin

you can do in phpmyadmin panel, select table or database change collation settings.

 

Configuring Password Access for the MySQL Root Account

SELECT user,authentication_string,plugin,host FROM mysql.user;

ALTER USER ‘root’@’localhost’ IDENTIFIED WITH caching_sha2_password BY ‘password’;

ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘password’;

SELECT user,authentication_string,plugin,host FROM mysql.user;

ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘password’;

SELECT user,authentication_string,plugin,host FROM mysql.user;

CREATE USER ‘sammy’@’localhost’ IDENTIFIED WITH caching_sha2_password BY ‘password’;

ALTER USER ‘sammy’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘password’;

GRANT ALL PRIVILEGES ON *.* TO ‘sammy’@’localhost’ WITH GRANT OPTION;

FInd replace in mysql phpmyadmin

mysql phpmyadmin find replace

 

troubleshoot

2022/11/14 05:54:17 [error] 10407#10407: *2768 FastCGI sent in stderr: “PHP message: phpmyadmin: Failed to load /var/lib/phpmyadmin/blowfish_secret.inc.php Check group www-data has read access and open_basedir restrictions” while reading response header from upstream, client: 103.228.33.114, server: rajugi2ne.com, request: “GET /phpmyadmin/index.php?route=/recent-table&ajax_request=1&recent_table=1&no_debug=true&_nocache=1668405256620516619&token=4169763f3147544c4266475c4a22597e HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host: “159.65.149.73”

MySQL Tutorial (create,connect database, update tables, export etc) Documentation & TIPS

  • mysqldump import /export mysql database command line, phpmyadmin, Cpanel, mysql workbench, xamp
  • mysql commands
  • phpmyadmin install / configure on nginx ubuntu 20.04 apache2 debian 10
  • improve mysql performance wordpress my.cnf file configuration
  • innodb buffer pool size measure & adjust by pages, read requests etc
  • mysql workbench tutorials (Sql Development , modelling, server admin export & import)
  • mysql errors
  • Innodb vs myisam (table engines row lock vs table lock)
  • mysql max connections limit check increase how to decide thread cache size
  • MySQL innodb memory allocation & usage calculation
  • MySQL query cache vs redis vs memcached buffer pool database cache
  • mysql 8 installation on ubuntu 20.4
  • mysql configuration file location linux , windows , mac
  • mysql root password change reset update set A-Z info
  • mysql user creation, password , grant permissions user management guide
  • mysql slow query log enable disable set query time ideal mysql long query time
  • mysql access denied for user 'root'@'localhost' (using password yes) no Error 1045
  • monitoring mysql with new relic
  • mysql restart ubuntu status start stop in linux windows reload
  • mysql open_files_limit increase to raise open file cache table definition cache
  • mysql memory limit setting increase or decrease allocation
  • mysqltuner installation suggestions
  • mysql auto backup ubuntu 22.04 using automysqlbackup
  • mysql high cpu usage cases and limiting cpu usage
  • mysql oom killer
  • mysql memory parameters
  • check mysql database size and table size
  • mysql find replace wordpress posts content
  • mysql import export database command line linux ubuntu debian wamp xamp
  • mysql interview questions and answers fresher to experience

hi i am raju ginni, primalry i manage wordpress websites on GCP cloud platform as a cloud engineer, and create content on passionate things.
you can follow me on youtbe

© 2025 - All Rights Reserved Disclaimer & Privacy Policy