thinkphp connecting MySQL problem

Source: Internet
Author: User
' Db_type '               = ' mysql ',     //database type ' db_host ' + '               localhost ',//server address ' db_name '               = ' test ',          // Database name ' Db_user ' +               ' root ',//      user name ' db_pwd '                = ' 123456 ',          //password ' db_port '               = + 3306,        // Port ' db_prefix '             = ' think_ ',    //database table prefix ' db_suffix ' + '             ,          //database table suffix    ' db_fieldtype_ Check '    = = False,//       whether field type checking    ' db_fields_cache ' = ' = '/        /enable field cache    ' Db_ CHARSET ' +            ' UTF8 ',      //Database encoding defaults to UTF8    ' db_deploy_type ' +        0,//Database deployment method: 0 Centralized (single server), 1 distributed (Master-slave server)    ' Db_rw_separate '        and False,       //database read/write separate master-slave valid

The password is right.
How to Prompt
The system has an error
You can choose [Retry] [back] or [go home]
[Error message]

Access denied for user ' root ' @ ' localhost ' (using Password:no)


Reply to discussion (solution)

The hint says the password is wrong, you say the password is wrong, but everybody who knows is your password wrong right?

Look here
http://topic.csdn.net/u/20111208/23/dacbb0fb-9cfc-4a5a-8377-3ad0d89d0a95.html?71662

User name, password is wrong?

User name, password is wrong?

if (mysql_connect ("localhost", "root", "123456")) {
echo "Success";
} can show success.

The hint says the password is wrong, you say the password is wrong, but everybody who knows is your password wrong right? if (mysql_connect ("localhost", "root", "123456")) {
echo "Success";
} can show success.

But Access denied for user ' root ' @ ' localhost ' (using Password:no)
I mean, there's no password for the connection.

But Access denied for user ' root ' @ ' localhost ' (using Password:no)
Is that there is no solution to the password given when connecting.

It's easy, you'll know when you test it.
Known
mysql_connect ("localhost", "root", "123456")
Can connect successfully
So
mysql_connect ("localhost", "root", "12345"); Note that I intentionally removed the last 6 of the password.
Error Access denied for user ' root ' @ ' localhost ' (using Password:yes)

mysql_connect ("localhost", "root"); Do not give a password
Error Access denied for user ' root ' @ ' localhost ' (using Password:no)

The problem is solved.
The configuration file is wrong-written.

Solved, but do not know why, the main configuration file config.php inside has
$config = Require './config.inc.php '; Config.inc.php inside is the common database configuration information
I deleted the config.inc.php to write the information directly in the main configuration file is actually OK ....

  • Related Article

    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.