OJS3: Installation problems connecting to database

I’ve installed the files and checked the permissions of folders and files. I created a user and a database in MySQL my database host is Localhost but when I input the information I keep getting an error below. I’m not sure how to resolve this I’ve tried a couple of options but was hoping for some specific help with the install. Thanks.

Errors occurred during installation
A database error has occurred: Access denied for user ‘my user name’@‘localhost’ (using password: YES)

‘my user name’ isn’t what it says I just put that there instead of my actual user name of my database.

Hi Pippin,

did you grant the user access to the database?
Can you connect to the database at the server using mysql -u your_username -p your_databasename?



The user has all privileges and is added to the database.

I’ve setup a few applications already using this setup. This is the first time I’ve tried installing OJS3 on a Godaddy Linux hosting before. I’m not sure what else to try.

Hi @Pippin,

I would suggest testing the connection with a short PHP script. See e.g. the selected answer on this StackOverflow thread. If that’s working, but your OJS installation isn’t, then I can help you debug it here; otherwise you’ll probably need to work with GoDaddy’s knowledge base.

Alec Smecher
Public Knowledge Project Team

Hi asmecher,

Looks like it was the database after all. I manually created a database instead of using the wizard and retested the connection using a PHP file (the code below). I was able to determine the original database was not connecting to the localhost but the second one I manually created was. Problem solved and Thank you very much.

# Fill our vars and run on cli
# $ php -f db-connect-test.php

$dbname = 'databasename';
$dbuser = 'username';
$dbpass = 'password';
$dbhost = 'localhost';

$connect = mysql_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
mysql_select_db($dbname) or die("Could not open the db '$dbname'");

$test_query = "SHOW TABLES FROM $dbname";
$result = mysql_query($test_query);

$tblCnt = 0;
while($tbl = mysql_fetch_array($result)) {
  #echo $tbl[0]."<br />\n";

if (!$tblCnt) {
  echo "There are no tables<br />\n";
} else {
  echo "There are $tblCnt tables<br />\n";