Announcement

Collapse
No announcement yet.

MySQL error: Access denied for user

Collapse
This topic is closed.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Any Version] MySQL error: Access denied for user

    If you are getting the above error, this means either:

    1. One or more of the following is wrong in your config.php file:

    - $config['Database']['dbname']
    - $config['MasterServer']['servername'] (except in rare cases, this should almost always be left as 'localhost' or '127.0.0.1')
    - $config['MasterServer']['username']
    - $config['MasterServer']['password'] (On some hosts your db password may be resticted to 8 characters or less.)

    If you are unsure of what the appropriate values are then you will need to ask your web host.

    2. Or that this db user is not assigned to that database or does not have permission to access MySQL to create or access a database. You may need to first manually create the database and assign the db user to it. Since each web host is different, if you do not know how to do this then contact your web host for help.

    3. It may sound silly but make sure you are uploading the edited config.php file to the correct directory, the vB 'includes' directory.

    4. Or you are running MySQL 4.1.x. As of MySQL 4.1.X there is a new password hashing system. PHP4 does not have builtin support for it as of yet, however PHP5 and the MySQLi library do. In order for your old PHP4 MySQL clients to be able to connect to the MySQL 4.1.X database you need to rehash the password using the old method. You should be able to run the following query to make it possible for PHP4 to access the MySQL 4.1.X database.

    SET PASSWORD FOR 'username'@'localhost' = OLD_PASSWORD('password');

    ...with 'username' and 'password' being the new 'username' and 'password' settings in your config.php file. This needs to be run as the MySQL 'root' user from the MySQL prompt, so if you do not have root access to this server you will need to ask your host to do this for you.

    More info is here:
    http://dev.mysql.com/doc/mysql/en/password-hashing.html
    http://dev.mysql.com/doc/mysql/en/up...-from-4-0.html

    5. In rare instances this probem can also occur if you already have the maximum number of databases your host allows and you do not have permission to create any new databases.

    There is one way around this, although is it less than ideal. And that is to install vB into an existing database. To do this, edit the config.php file to use those db details and make sure you edit the 'tableprefix' line to assign a unique prefix to the vBulletin tables. For instance:

    $config['Database']['tableprefix'] = 'vB3_';

    Then when you do the install, it will say the database already exists and ask you if you want to empty it. You must answer 'No' otherwise this will remove your other database info.

    ***

    Further info concerning this and other connection errors can be found here:

    http://dev.mysql.com/doc/refman/5.1/...ss-denied.html
    Last edited by Marco van Herwaarden; Thu 23rd Nov '06, 8:34am.
    Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
    Change CKEditor Colors to Match Style (for 4.1.4 and above)

    Steve Machol Photography


    Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.



  • #2
    If the error you are getting also includes this section:

    Invalid SQL:
    LOCK TABLES ......


    Then you need to make sure the DB user has LOCK permissions to this database.
    Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
    Change CKEditor Colors to Match Style (for 4.1.4 and above)

    Steve Machol Photography


    Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


    Comment


    • #3
      Note: With Yahoo hosting the database server name should be 'mysql', not 'localhost'.
      Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
      Change CKEditor Colors to Match Style (for 4.1.4 and above)

      Steve Machol Photography


      Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


      Comment


      • #4
        If your error is something like:

        Invalid SQL:
        CREATE INDEX languageid ON forumphrase (languageid,fieldname);

        MySQL Error : Access denied for user: 'dbusername@%' to database 'forum'

        ...and you have verified that your db user does have full permissions to this database, then this is a permissions issue. Try running the commands here to fix database privileges:

        http://mysql.com/doc/refman/4.1/en/m...ge-tables.html

        If you do not have 'root' access to the server, ask your host to do this for you.
        Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
        Change CKEditor Colors to Match Style (for 4.1.4 and above)

        Steve Machol Photography


        Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


        Comment


        • #5
          If you are running SELinux, please see this post:

          http://www.vbulletin.com/forum/showp...4&postcount=14
          Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
          Change CKEditor Colors to Match Style (for 4.1.4 and above)

          Steve Machol Photography


          Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


          Comment

          Working...
          X