2
4

4 回答 4

5

Sometimes in php/mysql there is a difference between localhost and 127.0.0.1

In mysql you grant access based on the host name, for localusers this would be localhost. I have seen php trying to connect with 'myservername' instead of localhost allthough in the config 'localhost' was defined.

Try to grant access in mysql for 127.0.0.1 and connect in php over 127.0.0.1 port 3306.

于 2008-10-29T10:14:13.780 回答
3

In case anyone’s still interested: I never did solve this particular problem. It really seems like the problem was with the hardware I was running MySQL on. I’ve never seen anything remotely like it since.

于 2012-12-14T09:35:34.530 回答
0

After I read your update I would suspect an error in/with the password. Are you using "strange" characters in your PW (something likely to cause utf-8/iso encoding problems)?

Using % in the Host field would allow the user to connect from any host. So the only thing that could be wrong would be the password.

Can you create another user. whith the "grant all on all for '...'@'%' identiefied by 'somesimplepw'" syntax, and try to connect with that user? Don't forget to 'flush privelidges'

For info on how to create a new user klick here

于 2008-10-31T10:38:24.310 回答
0

Today the FTP service of my web hosting provider is having some trouble, so I decide to realize a local virtual webserver for working on my website. I have installed EasyPHP 14.1 with phpMyAdmin and I have created my user and my database with tables.

First attempt: failed. I realized that the table I was looking for didn't exist. -> I solved creating the missing table.

Second attempt: failed. I realized that username that I set for my new user was diffrent from the username I used for my connection. -> I edited username.

Third attempt: failed. I realized that new database name was diffrent from database name I use for connection in my site. -> I edited db name.

Forth attempt: failed. I realized that between privileges of my new user there wasn't "Grant". I don't even know what "Grant" means, but let's try to enable it -> Added "Grant" privilege.

Fifth attempt: I win!

I hope my little adventure could help someone. =)

于 2014-02-20T18:19:25.543 回答