Page 1 of 1

Xamp 8.1.1 Access denied for user 'root'@'localhost

PostPosted: 05. January 2022 20:11
by Enigmisth
Good morning,

I just installed xamp 8.1.1 on a new pc just bought.

When I start wordpress

localhost / xxx / wp-admin

Any data I enter, the password is correct, gives me an error
"A critical error has occurred on your website"

Search in file

C: \ xampp \ apache \ logs \ error.log I find written

[Wed Jan 05 20: 10: 50.408402 2022] [php: error] [pid 26016: tid 1812] [client :: 1: 63412] PHP Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'root' @ 'localhost' ( using password: YES) in C: \\ xampp \\ htdocs \\ viv \\ wp-includes \\ wp-db.php: 1656 \ nStack trace: \ n # 0 C: \\ xampp \\ htdocs \\ viv \\ wp-includes \\ wp-db.php (1656): mysqli_real_connect (Object (mysqli), 'localhost', 'root', 'root', NULL, NULL, NULL, 0) \ n # 1 C: \ \ xampp \\ htdocs \\ viv \\ wp-admin \\ setup-config.php (310): wpdb-> db_connect () \ n # 2 {main} \ n thrown in C: \\ xampp \\ htdocs \ \ viv \\ wp-includes \\ wp-db.php on line 1656, referer: http: //localhost/viv/wp-admin/setup-config.php? step = 1 & language = it_IT

I can't find the cause of the problem. Do you have any ideas?

Re: Xamp 8.1.1 Access denied for user 'root'@'localhost

PostPosted: 05. January 2022 21:43
by Altrea
Hi,

are you sure the password you told wordpress is correct?
By default user root does not have any password.

Re: Xamp 8.1.1 Access denied for user 'root'@'localhost

PostPosted: 05. January 2022 22:00
by Enigmisth
Yes, 1000% safe

In the meantime that the post has been approved I tried to install version 7.4.27 and it works fine without problems.

So I'd say the problem is version 8

Re: Xamp 8.1.1 Access denied for user 'root'@'localhost

PostPosted: 05. January 2022 22:06
by Altrea
Enigmisth wrote:So I'd say the problem is version 8

Very unlikely that there is a serious problem already in the mysqli connect functions of PHP 8.1.1.
Which Wordpress version did you use?

Re: Xamp 8.1.1 Access denied for user 'root'@'localhost

PostPosted: 06. January 2022 00:34
by Altrea
I have tested it by myself now and was able to install Wordpress 5.9 RC1 on XAMPP 8.1.1-2.
Earlier versions like the Stable Wordpress 5.8.2 are not compatible with PHP 8.1

But this still does not explain your error message. Even with Wordpress 5.8.2 i could only get your error message if i used a wrong database user password.
The error trace with correct credentials you will get is this:
[05-Jan-2022 23:33:18 UTC] PHP Fatal error: Uncaught mysqli_sql_exception: Unknown column 'wp_' in 'field list' in C:\xampp\htdocs\wordpress\wp-includes\wp-db.php:2056
Stack trace:
#0 C:\xampp\htdocs\wordpress\wp-includes\wp-db.php(2056): mysqli_query(Object(mysqli), 'SELECT wp_')
#1 C:\xampp\htdocs\wordpress\wp-includes\wp-db.php(1945): wpdb->_do_query('SELECT wp_')
#2 C:\xampp\htdocs\wordpress\wp-admin\setup-config.php(317): wpdb->query('SELECT wp_')
#3 {main}
thrown in C:\xampp\htdocs\wordpress\wp-includes\wp-db.php on line 2056