php - Connect to MySQL in MAMP -
i'm trying make html form connect mysql database on mamp.
however i'm not able open mysql connection. keep getting message "could not connect"
my thoughts -
- the host incorrect
- the username and/or password incorrect. found information in config.inc.php, believe correct, there's possibility ..
here's php script
<?php class database { function insert() { $dbhost = 'localhost:8888'; $conn = mysql_connect($dbhost, 'root', 'root'); if (! $conn) { die('could not connect: ' . mysql_error()); } else { echo "connected"; } } }
?>
possible solutions this thread:
a) launch mamp, go preferences , set sql port 3306.
b) use set of commands:
ps aux | grep mysql lsof -i killall -9 mysqld
in terminal , restart mamp.
have nice day.
Comments
Post a Comment