Welcome to Geeklog, Anonymous Thursday, April 25 2024 @ 01:37 pm EDT

Question: Access denied for user (MySQL)

Answer: 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';
FLUSH PRIVILEGES;


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.

Hits: 32300

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