I'm doing the Laracasts for PHP Practitioner and can't connect to my local SQL database using a PDO PHP function.
I've reviewed all of the settings in MySQL Workbench for the database. The database name in the code is correct. The port is correct. The local host IP is correct.
try {
$pdo = new PDO('mysql:host 127.0.0.1:3306;dbname=Test', 'root', '');
} catch (PDOException $e) {
die('Could Not Connect');
};
I expected this to work and to be able to pull information from my SQL database tables. However, it continues to throw an exception and only give me my die command prompt.
I've also confirmed the MySQL server is running via MySQL workbench.
What needs to change in order for this command to properly connect?