I executed this in phpMyAdmin.
I executed these lines:
CREATE USER root IDENTIFIED BY PASSWORD '';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
I get this when trying to connect:
Connect failed: SQLSTATE[HY000] [1045] Access denied for user ‘root’@’localhost’ (using password: NO)
$dsn = 'mysql:dbname=one';
$user = 'root';
$password = '';
$pdo = "Not set";
try{
$pdo=new PDO($dsn, $user, $password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
}
catch(Exception $ex){
echo "Connect failed: " . $ex->getMessage();
}
Note that the connection above used to work..now it doesn’t (since I switched to XAMPP).
Are you sure that the root user doesn’t have a password? Do you have PhpMyAdmin installed to check this?
If the problem isn’t the privileges, then it’s probably the port. The default port of MySQL is 3306, so if your port for MySQL is now 82 that you have to add the port in the connection.