Welcome to Geeklog Friday, April 20 2018 @ 11:58 pm EDT

Access denied for user (MySQL)

If you get an error message like this:

Warning: mysql_connect(): Access denied for user: 'username@localhost' (Using password: YES) in
/path/to/geeklog/system/databases/mysql.class.php on line ...
Cannnot connect to DB server

then the problem is that Geeklog can not access the database. This can have several causes:

First of all, make sure the database settings in your db-config.php (config.php for older Geeklog releases) are correct, specifically the name and password of your MySQL user, the name of your database, and the name of your MySQL server.

If you're running your own server, you may need to give your MySQL user proper permissions. Log in to MySQL as the MySQL root user and issue these commands:

GRANT ALL PRIVILEGES ON database_name TO user@host IDENTIFIED BY 'password';

Replacing the lower-case strings with the actual values, of course.

If you want (or need) to be more restrictive with database permissions: You will need to at least grant the ALTER, CREATE, DELETE, INSERT, SELECT, and UPDATE permissions to your database user. ALTER and CREATE permissions are only needed for installing and upgrading Geeklog, as well as for installing plugins and other add-ons.

In addition to the above, if you're running Geeklog 1.3.10 or later on MySQL 4.x, you'll also need to grant the LOCK TABLES permissions to your database user.

FAQ Manager » Common problems » Access denied for user (MySQL)