Warning: mysql_connect (): Access denied for user 'root' @ 'localhost' (using password: YES ),
Http://www.androidren.com/index.php? Qa = 211 & qa_1 = warning-mysql_connect-access-denied-root % 40-localhost-password
The code may be written as follows:
//to make a connection with database$conn = mysql_connect("localhost", "root", "password") or die(mysql_error());
In some cases, you can change it to the following:
$conn = mysql_connect("localhost", "root")
Or$conn = mysql_connect("localhost", "root", "")
However, in some cases, the root cause is that the user of your current database is not authorized to access multiple databases.
In fact, the most likely reason is that your database does not exist. O (∩) O Haha ~
The solution is to start the database.
In this case, the performance is as follows:
1. Under the command line:
Forlong401: Documents forlong401 $ sudo mysql -- user = root-p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql. sock' (2)
2. on the browser:
Deprecated: Mysql_connect (): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in/Library/WebServer/Documents/qa-include/qa-db.phpOn line68
Warning: Mysql_connect (): Access denied for user 'root' @ 'localhost' (using password: YES) in/Library/WebServer/Documents/qa-include/qa-db.phpOn line68
Cocould not establish database connection. Please check the username, password and hostname in the config file, and if necessary set up the appropriate MySQL user and privileges.
3. on phpmyadmin:
#2002 unable to log on to the MySQL server