OJS installation error: a database error has occurred: Access denied for user xxxxx@localhost

I am attempting to install OJS but the installation page returns this error:

a database error has occurred: Access denied for user xxxx@‘localhost’

Can someone help please?

Here are the settings I’m using on the OJS Installation form:

Username: admin1
Password: xxxxxxx
Repeat password: xxxxxxx
Email: secretariat@ascilite.org
Primary locale: English
Client character set: Unicode (UTF-8)
Connection character set: Unicode (UTF-8)
Directory for uploads: home/ascilite/publication_files
Your server currently allows file uploads: Yes
Your server currently allows a maximum file upload size of: 512M
Database driver: MySQLi
Host: localhost
Username: admin1
Password: xxxxxxx
Database name: ascilite_ojs
x Create new database
OAI Repository Identifier: ojs.publications.ascilite.org
x Provide a unique site ID and OAI base URL to PKP for statistics and security alert purposes only.

And here is my PHP server configuration:

Server: Localhost via UNIX socket
Server type: MariaDB
Server connection: SSL is not being used Documentation
Server version: 10.2.36-MariaDB-cll-lve - MariaDB Server
Protocol version: 10
User: ascilite@localhost
Server charset: cp1252 West European (latin1)
Database client version: libmysql - 5.6.43
PHP extension: mysqliDocumentation curlDocumentation mbstringDocumentation
PHP version: 7.3.6

Hi @andrecolbert,

This is an error that other users of the software have encountered before. In this forum if you search for " database error has occurred: Access denied" - you 'll see a number of other posts where users have encountered this error, and where potential solutions to the issue you are facing are discussed. If you try some of these solutions, but do not find a solution to your own particular issues, let us know on this post, and we will try to suggest potential solutions.

Best regards,

PKP team

Hi Roger,

Thanks, I checked out those solutions. Solutions #1, #2 and #3 all suggest using the GRANT statement to overcome the access denied error. Solution #3 from Stack Overflow says the GRANT statement will be deprecated in future releases (posted in 2015) and so use the ALTER USER statement for this operation." but I only see examples using GRANT. For example;

GRANT ALL PRIVILEGES ON mydb.* TO myuser@localhost IDENTIFIED BY ‘mypasswd’;

It’s been 15 years since I worked with SQL so will this operation work? Does “mydb” apply to all DBs or do I need to specify the DB (which I can’t do because I haven’t run the OJS installation to create it). Or should I use wildcards in place of mydb.*

Assuming I have the correct operation syntax, my next question is:

  1. To run this operation, is it done from the MySQL query console in cPanel?
  2. If I insert a username and password in the query before the username exists, will the query be accepted or do I have to create that user first?
  3. When I run the OJS installation as the next step using this username and password, will OJS accept an existing user so long as that username/password are entered on the OJS installation page?

Many thanks for any assistance you can provide.

p.s. we have a separate paid OJS installation hosted by PKP, but is it correct that any technical issues should go thru this forum because this second instance of OJS will be a self-hosted installation for new journal?

Hi @andrecolbert,

I’m not sure about your database questions - but I’ll see if I can get someone else to weigh in.

Regarding your hosting: that’s correct. For your instances hosted by PKP|PS you submit support requests through them - but for self-hosted instances - you can post here on the forum.

PKP team

Hi @andrecolbert

This is not an OJS issue. With the “Access denied”, OJS is telling you that is not able to reach the DB because you don’t have the right credentials.

If you want to check it with a different tool, a good option is installing “adminer”… that is lik phpMyAdmin but in a single php file. You only need to upload in your root web folder to run and then, check if your credentials are fine.

My guess? Usually the “Host: localhost” won’t work in shared hostings… and you will find the right host somewhere in cpanel. Unfortunately we can’t help you with this because every hosting company keep their own UI so you will need to ask your hosting company to discover your credentials.

If your tech services give you the data or you manage to reach your DB (with adminer or any other software that ensures you have the right credentials) we can keep digging to discover if something is failing in the OJS side.