Question:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'admin'@'localhost' (using password:?
Donis
2010-07-11 13:13:53 UTC
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'admin'@'localhost' (using password: YES) in /home/a3859268/public_html/include/database.php on line 26


/* Make connection to database */

$this->connection = mysql_connect(localhost, admin, admin) or die(mysql_error());

mysql_select_db(, $this->connection) or die(mysql_error());

whats now wrong? someone can help me i just what create server. if someone can help me please write me mail donisdonce@yahoo.com. sorry from mistakes, i am not from england, my l language are very bad. thanx for hellping
Four answers:
Unca Alby
2010-07-11 13:18:27 UTC
Are you giving it the correct password? For a user that has access to that database?



Try the command line, "mysql -u{username} -p{password} -h{host} -d{database}" and see if you are able to connect that way. If you can connect that way, then you should be able to connect from PHP, so long as you're 100% certain you're passing it the identical same {username}, {password}, {host}, and {database}.
?
2016-04-12 16:27:54 UTC
There's no reason why the mysql_connect function shouldn't work as long as the MySql client has had the user "root" with the password of "YES" defined with the correct attributes for create, write, read, execute and possibly delete if necessary. Extract: Managing Databases Although all the database administrative options can be done through PHP scripts, I strongly suggest installing a copy of PHPMyAdmin on your server. It is an excellent free set of scripts that will provide you with an administrative interface for your MySQL database(s). You can add, remove, edit, backup and view your databases using this and it is especially useful when troubleshooting your databases.
Simon
2010-07-12 00:03:32 UTC
You need quotes around the login credentials



$this->connection = mysql_connect("localhost", "admin", "admin") or die(mysql_error());



Is your password really admin? The order of the arguments is host, user, password
Nope
2010-07-11 17:02:54 UTC
/* Make connection to database */



$this->connection = mysql_connect('localhost', 'admin', 'admin') or die(mysql_error());



mysql_select_db($this->connection) or die(mysql_error());



Make sure the passwords etc. Are correct and I reccommend mysql_pconnect()


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...