Warning:mysql_connect (): Access denied for user ' root ' @ ' localhost ' (using Password:yes)

Source: Internet
Author: User
Tags deprecated

http://www.androidren.com/index.php?qa=211&qa_1=warning-mysql_connect-access-denied-root%40- Localhost-password

The code might be written like this:

//to make a connection with database$conn=mysql_connect("localhost", "Root", "Password") or  die(Mysql_error());

In some cases, you can fix this by changing it to the following:

$conn = mysql_connect (" localhost "," root ")  OR  $conn = mysql_connect (" localhost "," root "," ")

但是,有些情况下它的根本原因是你的当前数据库的用户没有获得多数据库访问的授权。

其实,最多的原因可能是你的数据库没有起来。O(∩_∩)O哈哈~

解决方法是你启动数据库。

The performance in this case is:

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 would be removed in the Future:use mysqli or P Do instead in /library/webserver/documents/qa/qa-include/qa-db.phpon line

Warning: mysql_connect (): Access denied for user ' root ' @ ' localhost ' (using Password:yes) in /library/webser ver/documents/qa/qa-include/qa-db.php on line

Could not establish database connection. Please check the username, password and hostname with the config file, and if necessary set up the appropriate MySQL user an D privileges.

3. On the phpMyAdmin:

#2002 cannot log on to the MySQL server



Warning:mysql_connect (): Access denied for user ' root ' @ ' localhost ' (using Password:yes)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.