andrewharris
asked on
Warning: mysql_connect(): Access denied for user 'username'@'hostname.domain' (using password: YES)
I am trying to take over a PHP/MySQL system that someone else has done. I am setting up the web server and know that PHP works fine (example script works fine). However I get this error when PHP tries to conenct to the remote (on another server) MySQL Database. I can login without problem using the "username" login from the local machine.
Any Idea? I have NO CLUE when it comes to MySQL.
Andrew
Any Idea? I have NO CLUE when it comes to MySQL.
Andrew
i just noticed you said a remote server.
you need to make sure that you are using the right IP for the "localhost" part...
since this will be the IP of the server your connecting to
you need to make sure that you are using the right IP for the "localhost" part...
since this will be the IP of the server your connecting to
i don't think it's a host problem neester. when the error message says 'Access denied', the server has probably received something.
you probably forgot to give privileges to your host using GRANT command on the mysql server :
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'myremotehost' IDENTIFIED BY 'mypassword';
see GRANT syntax for details : http://dev.mysql.com/doc/mysql/en/GRANT.html
you probably forgot to give privileges to your host using GRANT command on the mysql server :
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'myremotehost' IDENTIFIED BY 'mypassword';
see GRANT syntax for details : http://dev.mysql.com/doc/mysql/en/GRANT.html
ASKER
psadac, I thought I had tried that but I did it again and got "Query OK, 0 rows affected (0.06 sec)" tried the site again but got exactly the same.
Just to give some more info. I own the server that has mysql on it. MySQL is version 4.1.8. In MySQL Administrator I can see my user "website" and if I click on that I have 2 options below it, localhost and 192.168.1.248.
The unedited error message is Warning: mysql_connect(): Access denied for user 'website'@'192.168.1.248' (using password: YES)
Andrew
Just to give some more info. I own the server that has mysql on it. MySQL is version 4.1.8. In MySQL Administrator I can see my user "website" and if I click on that I have 2 options below it, localhost and 192.168.1.248.
The unedited error message is Warning: mysql_connect(): Access denied for user 'website'@'192.168.1.248' (using password: YES)
Andrew
ASKER
Okey Dokey...well can you believe it it had to do with the password. I had hashes and dollars in my password. Not sure which one yet, but it didnt like one of them. I changed the password to something simple and now it works
Andrew
Andrew
lol.
ok great :)
well thats an anwer that i dont think anyone could have given you!
:D
ok great :)
well thats an anwer that i dont think anyone could have given you!
:D
ASKER
Is tehre anywhere I can log that as a bug? I am a little new to the MySQL game.
Andrew
Andrew
i am sure it wasn't a bug.
you probably had this:
$DB = mysql_connect("iphere","us erhere","p assword$he re#asdasd$ asdasd");
and php thought that $here and $asadasd were variables...
you probably had this:
$DB = mysql_connect("iphere","us
and php thought that $here and $asadasd were variables...
ASKER
It was slightly different so tell me if this is still not a bug (going off the top of my head so syntax may not be 100% but you get my drift)
$hostname = "192.168.1.248"
$username = "website"
$password = "password$here#asdasd$asda sd"
$DB = mysql_connect($hostname,$u sername,$p assword);
Andrew
$hostname = "192.168.1.248"
$username = "website"
$password = "password$here#asdasd$asda
$DB = mysql_connect($hostname,$u
Andrew
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hai,
Try this.
GRANT ALL PRIVILEGES ON *.* TO website@"%" IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO website@192.168.1.248 IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Bye
Ajai
Try this.
GRANT ALL PRIVILEGES ON *.* TO website@"%" IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO website@192.168.1.248 IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Bye
Ajai
ajai - we worked it out mate :)
ASKER
lol. you rekon!:-D
Hope I've guided him to right direction....
ASKER
Just get sick of having to open a new post when I answered the question myself and then the post gets removed and no one gets the benefit of my answer.
Basically if you answer yourself and ask for PAQ - refund, it is saved
>> Just get sick of having to open a new post when I answered the question myself and then the post gets removed and no one gets the benefit of my answer.
Wow this is an old thread, cant remember it anymore.
Thanks for the A.
Wow this is an old thread, cant remember it anymore.
Thanks for the A.
ASKER
Ha Ha. Yeah very old. Cheers
Andrew
Andrew
Here is the function your using:
mysql_connect(HOST,USERNAM
the HOST is usually localhost.
the username is whatever you set it to, same with password.
eg:
$DB = mysql_connect('localhost',
ALTHOUGH, some hosting resellers like to append your account name beofre the mysql login... eg:
my hosing does, so if i make a user called: databasemanager
then the actual login will be: neester_databasemanager
tryy that!