0

I've setup mysql server 8.0, Apache2.4, php 7.2 and created a simple database.

As a start I am trying to write a php code for connecting to the database but i can't figure it out. My code:

<?php
$con = mysqli_connect("localhost","Don","password","db1");

if (!$con) {
echo "Error: " . mysqli_connect_error();
exit();
}

echo 'Connected to MySQL';
?>

I get Error: The server requested authentication method unknown to the client.

I've tried several things: connect to root, 192.168.0.1 instead of localhost but nothing is working.

Any ideas? Thanks.

Don
  • 13
  • 3
  • Check [this](https://serverfault.com/questions/385378/mysql-connect-the-server-requested-authentication-method-unknown-to-the-clien), might help – Gynteniuxas May 06 '18 at 09:10
  • Have you double checked that the "Don" database user has the required permissions to access and/or interact with the db1 database? – SpacePhoenix May 06 '18 at 09:28

1 Answers1

0

(post for someone who has the same problem)

i searched about the old password issue but i couldnt find the old_passwords var, not even in my.cnf file.

so what i did was uninstalling mysql server 8.0 and installing 5.7.2 and it worked.

ps i didnt configure anything differently while setting up the 5.7.2 version.

Don
  • 13
  • 3