Thanks for that great response Geoff. That very well may be what is wrong, however, my problem is I don't have admin access to this server - it hosted in a BaaS site where they do all the admin. They do provide mysql command line access and it works, but it won't let me log in as root, not even on the command line. Where is the '@'ip70-162-142-180.ph.ph.cox.net' part coming from? I have to assume mysql_connect itself is appending that in the call since it's not part of the contents of the variable I pass from the form. And if I can't get server root access then that begs the question: how do I tell mysql_connect to turn that off and just send the user as-is? Thanks, On Apr 21, 2013, at 1:42 AM, Geoff Lane <geoff@xxxxxxxxxxxxx> wrote: > Hi, > > On Sunday, April 21, 2013, 3:37:38 AM, you wrote: > >> Night now this is just a test server. On the real thing I'll do it right. > > FWIW, the error you describe is one that I've seen often when setting > up a new development/test server. In my case, the issue has arisen > because the user doesn't have permission to connect to the database. > This drove me nuts for a couple of days until I read the error message > a little more carefully. In your case, you have: > >> *Warning*: mysql_connect() [function.mysql-connect >> <http://localhost/wservices/function.mysql-connect>]: Access denied for >> user '<user>'@'ip70-162-142-180.ph.ph.cox.net' (using password: YES) in >> */Library/WebServer/Documents/wservices/connect.php* on line *29* > > Notice that the username isn't just 'user', but 'user@host'. > Hopefully, you have access to the MySQL command line on the MySQL > server. If so, log on as root then do: > > mysql>use mysql; > mysql>select user,host from user; > > In the results table, check which hosts your user is permitted to > connect from. Let's say for now that your results table looks like: > > +------------------+-----------+ > | user | host | > +------------------+-----------+ > | root | myserver | > | root | 127.0.0.1 | > | debian-sys-maint | localhost | > | root | localhost | > +------------------+-----------+ > > To permit a user to connect from any host, change the host value to '%' > e.g: > mysql>update user set host='%' where user='root' and host='myserver'; > permits user 'root' to connect from any host rather than just from > 'myserver', the loopback IP address, and 'localhost'. > > If that doesn't work, you probably need to configure mysql to permit > connections from any host. To do this, edit my.cnf (which should be > /etc/mysql/my.cnf in Debian-based systems) and search for the line: > bind-address = 127.0.0.1 > Comment this out and replace with: > bind-address = 0.0.0.0 > > Hopefully, that'll sort out the one test user you've tried so far. > Note that you'll need to take responsibility for verifying your users > at the application level or you'll need to create a new entry in the > user table with CREATE USER; GRANT appropriate privileges; and then > update the user's record to permit connection from the appropriate > host(s). > > HTH, > > -- > Geoff Lane > Cornwall, UK > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php