jyr / MNPP

Mac + Nginx + Percona + PHP a high performance web server in a one-click installer
http://getmnpp.org
314 stars 49 forks source link

Connect to a server besides localhost #50

Closed tim-peterson closed 11 years ago

tim-peterson commented 12 years ago

I've got MNPP all set up on my Mac but can't figure how to connect to a database that isn't localhost. I've got a MySQL database on an EC2 instance that i'd like to connect to.

I'm using Codeigniter/PHP and the following configuration works:

`$db['default']['hostname'] = "localhost"; 
$db['default']['password'] = "";

and the following does NOT work:

$db['default']['hostname'] = "mysite.com";  // the domain name of my EC2 instance
$db['default']['password'] = "my_password";

Do I need to change anything in my my.cnf or anywhere else to get this to work?

jyr commented 12 years ago

You need in your mysql conf allow external connections and open the port that will use it. Look

http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html http://dev.mysql.com/doc/refman/5.0/en/connecting.html

Good Luck!

tim-peterson commented 12 years ago

@jyr thank you, might you provide some specific code, i'm not quite sure what you mean? For example, are you referring to the my.cnf file on my Mac or my EC2 instance?

jyr commented 12 years ago

Tim,

Sorry, I mean to my.cnf in your EC2 instance