There are some problems in my mac. One of the Problems is that there are two mysqls in computer. First mysql is executed at localhost and second one is at MAMP. Because of this, when i tryed to connect mysql using php
<?phpmysqli_connect('localhost','root','$password','dbname') ?>
, it is connected to MAMP mysql.
And when i tryed to connect mysql using terminal, it is connected to localhost mysql. So i can't do what i want...(When i make some db(named 'dbname') and try to connect at my html, it makes an error Warning: mysqli_connect(): (42000/1049): Unknown database 'dbname'
)
What should i do to make it work?..
you can learn how to connect with mysqli in php here
http://www.w3schools.com/php/php_mysql_connect.asp
or connect in terminal like this
/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.