NYCPHP Meetup

NYPHP.org

[nycphp-talk] mysql connection

Rob Marscher rmarscher at beaffinitive.com
Fri Nov 12 16:07:42 EST 2010


On Nov 12, 2010, at 4:02 PM, willie klein wrote:
> Setting up a new server and finally splitting my apache server and mysql server into 2 virtual boxes.
> For some reason I can’t connect to the remote server with php but I can connect with mysql command line.
> I think it must be some way I compiled php, tried just using rpms also.

I'm not sure it's your php compilation.  What about mysql permissions?  Can you connect via mysql command line running on your apache server to the mysql server?  Also want to make sure the port is open on the mysql server (usually 3306) and that the mysql server doesn't have "skip-networking" in it's my.cnf.  The permissions for mysql users includes the hostname that user is allowed to connect from.  If you want to open up the permissions for the user so they can connect from any server, you want to do something like this:

CREATE USER 'username'@'%' IDENTIFIED BY 'password';
GRANT USAGE ON *.* TO 'username'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON `dbname` . * TO 'username'@'%';
FLUSH PRIVILEGES;

The % wildcard allows the user to connect from any host.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20101112/1ac44a13/attachment.html>


More information about the talk mailing list