I upgraded from Ubuntu 20.04 to Ubuntu 22.04. After that, phpMyAdmin would not work. Attempts to open phpMyAdmin showed a blankpage, or a "connection refused" page.
From the apache2 error.log:
> [Mon Sep 26 17:46:34.097236 2022] [php:error] [pid 1055] [client
> ::1:37214] PHP Fatal error: Uncaught mysqli_sql_exception: SELECT
> command denied to user 'peter'@'localhost' for table 'user' in
> /var/www/html/phpMyAdmin/libraries/classes/Dbi/DbiMysqli.php:199\nStack
> trace:\n#0
> /var/www/html/phpMyAdmin/libraries/classes/Dbi/DbiMysqli.php(199):
> mysqli->query()\n#1
> /var/www/html/phpMyAdmin/libraries/classes/DatabaseInterface.php(316):
> PhpMyAdmin\\Dbi\\DbiMysqli->realQuery()\n#2
> /var/www/html/phpMyAdmin/libraries/classes/DatabaseInterface.php(2390):
> PhpMyAdmin\\DatabaseInterface->tryQuery()\n#3
> /var/www/html/phpMyAdmin/libraries/classes/DatabaseInterface.php(2332):
> PhpMyAdmin\\DatabaseInterface->isUserType()\n#4
> /var/www/html/phpMyAdmin/libraries/server_common.inc.php(43):
> PhpMyAdmin\\DatabaseInterface->isSuperuser()\n#5
> /var/www/html/phpMyAdmin/index.php(116): include('...')\n#6 {main}\n
> thrown in /var/www/html/phpMyAdmin/libraries/classes/Dbi/DbiMysqli.php
> on line 199
As root I gave myself all privileges on table user
The command line says phpmyadmin is installed and the latest version:
> phpmyadmin is already the newest version (4:5.1.1+dfsg1-5ubuntu1).
What is necessary to make it work from Ubuntu, without downloading it again?
To get phpMyAdmin working, I did the following:
You should have MySQL server working and have user privileges on a database.
To get phpMyAdmin working on Ubuntu:
Delete the existing phpMyadmin folder in /var/www/html/
Download the latest version from https://www.phpmyadmin.net/downloads/
Unzip the file
Rename the folder phpMyAdmin (get rid of the language part)
Move it to /var/www/html/
Set the permissions:
sudo chown -R pedro /var/www/html
sudo chgrp -R www-data /var/www/html/
sudo chmod -R 770 /var/www/html/
sudo chmod g+s /var/www/html/
After that, it should just work!
What should I have done to make it work Ubuntu-style?
In Ubuntu, where should the phpMyAdmin folder be put??
As it is now, localhost/phpMyAdmin/ leads to the index file of /var/www/html/phpMyAdmin/ and everything is working.
0 Answers