PHP with MySQL 8 0 error The server requested authentication method unknown to the client

0 votes

I'm running MySQL version 8 on PHP 7.0.

when I try to connect to my database from PHP I'm getting the following error:

Connect Error: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

PHP show this error:

Warning: mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password] in D:\xampp\htdocs\reg\server.php on line 10

How can I fix this problem?

Jun 18, 2022 in PHP by narikkadan
• 63,600 points
1,263 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Edit my.cnf file and put this setting in mysqld section:

[mysqld]
default_authentication_plugin= mysql_native_password

Then run following command:

FLUSH PRIVILEGES;

I hope this helps you.

answered Jun 19, 2022 by Kithuzzz
• 38,000 points

edited Mar 5

Related Questions In PHP

0 votes
1 answer

error: mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password] in...

Hello @kartik, Use this SQL command: ALTER USER 'mysqlUsername'@'localhost' ...READ MORE

answered Oct 27, 2020 in PHP by Niroj
• 82,840 points
25,304 views
0 votes
1 answer

How can I use Sockets.io on the client side and communicate with a PHP based application on the server?

Hello @kartik, For 'long-lived connection' , you can ...READ MORE

answered Aug 24, 2020 in PHP by Niroj
• 82,840 points
3,167 views
0 votes
1 answer

Error:PHP Warning: POST Content-Length of 8978294 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

Hello @kartik, 8388608 bytes is 8M, the default ...READ MORE

answered Sep 17, 2020 in PHP by Niroj
• 82,840 points
29,033 views
0 votes
1 answer

Error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM' at line 9

Hello @kartik, Replace TYPE=MyISAM with ENGINE=MyISAM The problem was "TYPE=MyISAM" which should ...READ MORE

answered Nov 16, 2020 in PHP by Niroj
• 82,840 points
11,468 views
0 votes
1 answer

How to configure PHP with the Apache Web Server?

To configure PHP with the Apache Web ...READ MORE

answered Dec 17, 2024 in PHP by Navya
142 views
0 votes
1 answer

Connection with MySQL server using PHP. How can we do that?

Hey @kartik, You have to provide MySQL hostname, ...READ MORE

answered Mar 27, 2020 in PHP by Niroj
• 82,840 points
1,504 views
0 votes
0 answers

SQLSTATE[HY000] [1045] Access denied for user 'username'@'localhost' using CakePHP

I'm new to CakePHP and PHP. While ...READ MORE

Aug 30, 2022 in Database by Kithuzzz
• 38,000 points
3,475 views
0 votes
2 answers

Define a SQL query? What is the difference between SELECT and UPDATE Query? How do you use SQL in SAS?

HI.. SQL is Structured Query Language, which is ...READ MORE

answered Aug 8, 2020 in PHP by anonymous
10,966 views
0 votes
1 answer

Why is not preferable to use mysql_* functions in PHP?

The reasons are as follows: The MySQL extension: Does ...READ MORE

answered Sep 7, 2018 in Database by DataKing99
• 8,250 points
1,379 views
0 votes
2 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP