Acess denied for user 'root' or unable to create database

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Acess denied for user 'root' or unable to create database

Postby bennypr0fane » 28. August 2020 14:43

Hello,
I installed XAMPP on my Majaro Linux, and the control panel says all servers start fine.
Going to localhost/phpmyadmin, I get this error message:
Error
MySQL said: Documentation
Cannot connect: invalid settings.
mysqli::real_connect(): (HY000/1698): Access denied for user 'root'@'localhost'
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.


I tried the following:
Changed user in line 31 in /opt/lampp/phpmyadmin/config.inc.php from
Code: Select all
$cfg['Servers'][$i]['user'] = 'root';
to my Linux user ben.

That lets me get into phpmyadmin, but I can't do anything, e.g. create a new database:
#1044 User “@‘localhost’” has no permission to access database newDB


so there’s a username missing here before the @.
I also posted about it here: https://discuss.codecademy.com/t/error-incorrect-database-name/526878/15 and here:
https://forum.manjaro.org/t/cannot-create-database-in-phpmyadmin-xampp/15993
Xampp version 7.3.11-0 from Arch Linux user repositories
bennypr0fane
 
Posts: 7
Joined: 28. September 2014 17:38
Location: Austria
Operating System: Ubuntu 14.04

Re: Acess denied for user 'root' or unable to create databas

Postby bennypr0fane » 28. August 2020 14:56

For completeness, her's line 29 to 36 in my config.inc.php:
Code: Select all
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
/* Server parameters */
//$cfg['Servers'][$i]['host'] = 'localhost:3306';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = true;
Xampp version 7.3.11-0 from Arch Linux user repositories
bennypr0fane
 
Posts: 7
Joined: 28. September 2014 17:38
Location: Austria
Operating System: Ubuntu 14.04

Re: Acess denied for user 'root' or unable to create databas

Postby Nobbie » 28. August 2020 15:43

There is still 'root' as User:

Code: Select all
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';


Try to enter UserID and Passwort by yourself, therefore change AuthType from 'config' to 'cookie':

Code: Select all
$cfg['Servers'][$i]['auth_type'] = 'cookie';


Phpmyadmin will start with a login dialog with that setting. The setting of user and password in config.inc.php becomes obsolete (you can delete that lines, you can leave them, you can outcomment them - does not matter). Enter a valid MySQL User and passwort. Keep in mind: these Users ARE NOT the same users as in your linux operating system! So if you are running as user "ben" in linux, it is useless to enter "ben" here in Phpmyadmin.

When Xampp is a fresh install, user "root' without password is pre-installed in MySQL (MariaDB).You can change/edit/add/delete MySQL users in Phpmyadmin as well as Passwords.
Nobbie
 
Posts: 13177
Joined: 09. March 2008 13:04

Re: Acess denied for user 'root' or unable to create databas

Postby bennypr0fane » 28. August 2020 16:34

Thanks a lot!
these Users ARE NOT the same users as in your linux operating system!

When Xampp is a fresh install, user "root' without password is pre-installed in MySQL (MariaDB

In that case, one should be able to login as root, with no password, yes? Does it say anywhere user needs to be changed to something else before we can start - and I overlooked it?

Try to enter UserID and Passwort by yourself, therefore change AuthType from 'config' to 'cookie':

$cfg['Servers'][$i]['auth_type'] = 'cookie';

Phpmyadmin will start with a login dialog with that setting. The setting of user and password in config.inc.php becomes obsolete (you can delete that lines, you can leave them, you can outcomment them - does not matter). Enter a valid MySQL User and passwort. Keep in mind: these Users ARE NOT the same users as in your linux operating system! So if you are running as user "ben" in linux, it is useless to enter "ben" here in Phpmyadmin.

I didn't understand which order I should make these changes in. I changed auth_type from config to cookie now, was that the correct first step? Still can't login as root though.

Image

Also, since I haven't configured any MySQL users (and can't use phpmyadmin to do it), I don't know which "valid MysQL user" I should put there.
Xampp version 7.3.11-0 from Arch Linux user repositories
bennypr0fane
 
Posts: 7
Joined: 28. September 2014 17:38
Location: Austria
Operating System: Ubuntu 14.04

Re: Acess denied for user 'root' or unable to create databas

Postby bennypr0fane » 31. August 2020 13:57

Hello, I was wondering if you could tell me more exactly which order to follow the steps in that you recommended, that would be very helpful! Thanks!

Nobbie wrote:There is still 'root' as User:

Code: Select all
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';


Try to enter UserID and Passwort by yourself, therefore change AuthType from 'config' to 'cookie':

Code: Select all
$cfg['Servers'][$i]['auth_type'] = 'cookie';


Phpmyadmin will start with a login dialog with that setting. The setting of user and password in config.inc.php becomes obsolete (you can delete that lines, you can leave them, you can outcomment them - does not matter). Enter a valid MySQL User and passwort. Keep in mind: these Users ARE NOT the same users as in your linux operating system! So if you are running as user "ben" in linux, it is useless to enter "ben" here in Phpmyadmin.

When Xampp is a fresh install, user "root' without password is pre-installed in MySQL (MariaDB).You can change/edit/add/delete MySQL users in Phpmyadmin as well as Passwords.
Xampp version 7.3.11-0 from Arch Linux user repositories
bennypr0fane
 
Posts: 7
Joined: 28. September 2014 17:38
Location: Austria
Operating System: Ubuntu 14.04

Re: Acess denied for user 'root' or unable to create databas

Postby Nobbie » 31. August 2020 18:44

Which order? There is no order, simply change "config" to "cookie". What a strange question?! Where do you expect an order? Simply change one word into another. Is that so difficult to understand??

Actually i have the feeling that you dont tell us everything, i think you are NOT running a fresh install. I cannot help you on that, if "root" (without password) does not work, someone has changed something. Delete the whole Xampp folder (/opt/lampp) and start from scratch.
Nobbie
 
Posts: 13177
Joined: 09. March 2008 13:04


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 47 guests