Saber2pr's Blog



docker pull mysql/mysql-server:5.7.39-1.2.9-server
brew install shivammathur/php/[email protected]

When establishing-a-database-connection appears, first confirm that you can connect successfully with DBeaver and other database connection tools to ensure that the account password is correct. It is recommended that mysql5.7 + php5.6,mysql8 and php7 compatibility is not very good. If the above confirmation or still cannot connect to the database, create a test.php file under the project:

$link = mysqli_connect('', 'root', '123456');
if (!$link) {
die('Could not connect: ' . mysqli_error());
echo 'Connected successfully';

Then run the project (you can use the vscode plug-in PHP Server) to see if the page output is Connected successfully

Reference article: