I’m having trouble connecting to my local MySQL database from my PHP script.
I can connect from the command line using the following
mysql --host=127.0.0.1 --port=8889 --user=root -p
but when I use the code below to connect from my PHP script, it’s not working
$dbc = @mysqli_connect ('localhost:8889', 'root', 'root', 'test') OR die ('<p>Could not connect to the database!</p></body></html>')
Any ideas?
Don’t specify the port in the first argument. It goes in the fifth spot: