Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Welcome to the CollectiveAccess support forum! Here the developers and community answer questions related to use of the software. Please include the following information in every new issue posted here:

  1. Version of the software that is used, along with browser and version

  2. If the issue pertains to Providence, Pawtucket or both

  3. What steps you’ve taken to try to resolve the issue

  4. Screenshots demonstrating the issue

  5. The relevant sections of your installation profile or configuration including the codes and settings defined for your local elements.


If your question pertains to data import or export, please also include:

  1. Data sample

  2. Your mapping


Answers may be delayed for posts that do not include sufficient information.

Access denied to db, I am sure credentials are correct.

The installation page indicates that collectiveaccess is not able to access the database.

Fatal error: Uncaught DatabaseException: Access denied for user 'providenceuser'@'localhost' to database 'providencedb' in /var/www/html/providence/app/lib/Db/mysqli.php:144 Stack trace: #0 /var/www/html/providence/app/lib/Db.php(134): Db_mysqli->connect() #1 /var/www/html/providence/app/lib/Db.php(108): Db->connect() #2 /var/www/html/providence/app/lib/ConfigurationCheck.php(103): Db->__construct() #3 /var/www/html/providence/install/inc/page1.php(44): ConfigurationCheck::performInstall() #4 /var/www/html/providence/install/index.php(148): require_once('/var/www/html/p...') #5 {main} thrown in /var/www/html/providence/app/lib/Db/mysqli.php on line 144

However, I have double checked the credentials, and can access the database using those same credentials from the command line:

root@devtest:/home/dev-admin# mysql -u 'providenceuser' -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 104
Server version: 10.3.25-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Although it was not sufficient to fix the issue, on my installation (Ubuntu 20.04/Mariadb 10.3.24) I had to specifically allow non-root users to connect as the database user:

UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE user = 'providenceuser' AND plugin IN ('unix_socket', 'auth_socket');

FLUSH PRIVILEGES;

Comments

  • Also, I should note that these are the permissions I set:

    sudo chown -R www-data:www-data /var/www/html/providence/
    sudo chmod -R 755 /var/www/html/providence/
    sudo chmod -R 777 /var/www/html/providence/media
    sudo chmod -R 777 /var/www/html/providence/app/log
    sudo chmod -R 777 /var/www/html/providence/app/tmp
    sudo chmod -R 777 /var/www/html/providence/vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache
    
  • edited October 29

    And of course both the db and the website are running on localhost.

    Db was set up like so:

    CREATE DATABASE providencedb;
    CREATE USER 'providenceuser'@'localhost' IDENTIFIED BY 'passw0rd';
    GRANT ALL ON providencedb TO 'providenceuser'@'localhost' IDENTIFIED BY 'passw0rd' WITH GRANT OPTION;
    FLUSH PRIVILEGES;
    EXIT;
    

    This is clearly not a providence-specific issue, but any help would still be appreciated.
    I tried this as a test, filled out like this:

    $dbname = 'providencedb';
    $dbuser = 'providenceuser';
    $dbpass = 'passw0rd';
    $dbhost = 'localhost'; # also tried 127.0.0.1
    

    and got this:

    Could not open the db 'providencedb'
    

    With the test app, if I changed the db user 'root' and left the password empty as '', it seems I am able to connect:

    There are no tables<br />
    

    However, the same thing did not work for Providence, giving me the same error.

  • 1 more thing that I don't expect is relevant but am not sure. In the background (separate from the error quoted in the question), I have some warnings:

    Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/html/providence/app/helpers/utilityHelpers.php on line 3883
    
    Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/html/providence/app/lib/BaseModel.php on line 3576
    
    Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/html/providence/app/lib/Search/SearchIndexer.php on line 1586
    
    Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/html/providence/app/lib/BundlableLabelableBaseModelWithAttributes.php on line 3433
    
    Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/html/providence/app/lib/BundlableLabelableBaseModelWithAttributes.php on line 3736
    
    Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/html/providence/app/lib/BundlableLabelableBaseModelWithAttributes.php on line 3880
    
    Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/html/providence/app/lib/BundlableLabelableBaseModelWithAttributes.php on line 4831
    
    Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/html/providence/app/lib/LabelableBaseModelWithAttributes.php on line 890
    
    Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/html/providence/app/lib/Attributes/Values/ListAttributeValue.php on line 545
    
    Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/html/providence/app/lib/Zend/Feed/Entry/Atom.php on line 104
    
    Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/html/providence/app/lib/ModelSettings.php on line 126
    
    Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/html/providence/app/lib/Parsers/DisplayTemplateParser.php on line 537
    
    Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/html/providence/app/helpers/searchHelpers.php on line 692
    
    Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/html/providence/app/helpers/searchHelpers.php on line 734
    
  • It seems that the issue was with how I created my database:

    GRANT ALL ON providencedb TO 'providenceuser'@'localhost' IDENTIFIED BY 'passw0rd' WITH GRANT OPTION;
    

    I was able to install when I recreated it like this:

    GRANT ALL ON providencedb.* TO 'providenceuser'@'localhost' IDENTIFIED BY 'passw0rd' WITH GRANT OPTION;
    

    I was able to proceed with the installation. The other things that were different about the new installation are that I used Ubuntu 18.04 and php7.2.

Sign In or Register to comment.