0

I'm using wampserver 3.2.0 and mysql 8.0.18.

I already reinstalled the wampserver and started everything from the begining after many tries, so now with fresh reinstall and clear datas this is what i did:

Set password for the root "pass123", after this i created a database (testdb) at wampserver>mysql>mysql console (i was logged in as root), then filled it up with the data i needed. Checked the user accounts/privileges, and the database privileges, i have all the privileges everywhere as root, but still i get this error message: screenshot about the problem

my code:

<?php
$ser="localhost";
$user="root";
$pass="pass123";
$db="testdb";

$connect = mysqli_connect($ser ,$user ,$pass ,$db) or die("Connection Failed");
echo "Connected!"
?>

Thanks in advance! (i'm new to php)

Lim
  • 1
  • 1
  • 1
  • Have you looked at [this answer](https://stackoverflow.com/questions/10299148/mysql-error-1045-28000-access-denied-for-user-billlocalhost-using-passw) yet to see if it applies to you? – Morgan Feb 11 '20 at 21:47
  • Hello Morgan! Thanks for the fast answer, but sadly not applies to me... now i created a new user (added all the privileges) and a new database. From cmd i can log in with the new user, but when i try to acces the database (phpmyadmin?) trough php i get the same error. – Lim Feb 11 '20 at 22:20
  • Does this answer your question? [Warning: mysqli\_connect(): (HY000/1045): Access denied for user 'username'@'localhost' (using password: YES)](https://stackoverflow.com/questions/25174183/warning-mysqli-connect-hy000-1045-access-denied-for-user-usernameloca) – Martin Zeitler Feb 11 '20 at 22:51
  • Hello Martin! Sadly doesn't answer it, tried a few things from the page. But thanks! – Lim Feb 11 '20 at 23:43

2 Answers2

1

I solved the problem by specifying the exact port number used by mySQL. The standard port is 3308, so just change the following line:

$ser="localhost:3308";
Philipp Maurer
  • 2,480
  • 6
  • 18
  • 25
adkajic
  • 11
  • 3
-1

Not the actual SOLUTION, but, it works fine. Easy.

If you have the same problem, DO NOT use WAMP, use XAMPP instead.

With the same settings, it works.

Lim
  • 1
  • 1
  • 1