I have recently installed the last version of WAMP, but I have a problem accessing the MySQL (MariaDB) Server. I can access the server with MariaDB Console. Therefore, I am sure password and username are correct, and the server is running.
WAMP: 3.2.2
Apache: 2.4.41
PHP: 7.4.0
MariaDB: 10.4.10
phpMyAdmin: 5.0.2
When I access with phpMyAdmin webpage:
I also tried to access with a simple test script:
<?php
$servername = "localhost";
$username = "root";
$password = "";
try {
$conn = new PDO("mysql:host=$servername;dbname=myDB", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully";
} catch(PDOException $e) {
echo "Connection failed: " . $e->getMessage();
}
?>
When running in browser I got similar error:
Running the same script from the command line, works:
I tried to change $servername = "127.0.0.1"; and got the same result.
I also tried to change the password of the root user from MariaDB console, with the command:
FLUSH PRIVILEGES;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
The password changed, I've updated the test script $password = "MyNewPass";, and still the same result.
WAMP, right click, Tools-> Test port 3306. Also gives the expected result:
***** Test which uses port 3306 *****
===== Tested by command netstat filtered on port 3306 =====
Test for TCP
Your port 3306 is used by a processus with PID = 8660
The processus of PID 8660 is 'mysqld.exe' Session: Services
The service of PID 8660 for 'mysqld.exe' is 'wampmariadb64'
This service is from Wampserver - It is correct
Test for TCPv6
Your port 3306 is used by a processus with PID = 8660
The processus of PID 8660 is 'mysqld.exe' Session: Services
The service of PID 8660 for 'mysqld.exe' is 'wampmariadb64'
This service is from Wampserver - It is correct
Any help will be appreciated.


