FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    Unable to connect to database

    Scheduled Pinned Locked Moved
    Q&A
    0
    2
    1.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      tarun.verghis
      last edited by

      Hi, I'm having issues setting up FusionAuth on my EC2 instance. FusionAuth is unable to connect to a PostgresQL database on the same box.

      System information:
      Ubuntu 18.04.5 LTS
      PostgreSQL 12.5

      Database is running on the default port (5432). I created a database with the same name as the user I usually SSH into the box as. The user is a database superuser. I've confirmed that I can run psql as this user and connect to the database and run commands.

      In the FusionAuth maintenance mode page, I have the following settings:

      • Host: localhost
      • Port: 5432
      • Database: <name of the superuser> (already created)

      I also specified the superuser credentials and verified that they are correct. Additionally, I also left the generated FusionAuth user credentials in place.

      When I try to Submit the form, it says:
      Unable to connect to your database using either the superuser username and password or ordinary username and password you provided. Please verify your connection information. If it is correct, make sure the database is running before continuing.

      I've verified all of the above is correct, but still no dice.

      I stopped the FusionAuth process, deleted the logs and started fresh. Here are the complete logs from an isolated attempt to start FusionAuth and submit the maintenance mode information once:

      Tomcat started.
      NOTE: Picked up JDK_JAVA_OPTIONS:  --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
      23-Jan-2021 19:10:23.971 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib]
      23-Jan-2021 19:10:24.440 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-9011"]
      23-Jan-2021 19:10:24.457 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
      23-Jan-2021 19:10:24.492 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["https-jsse-nio-9013"]
      23-Jan-2021 19:10:24.783 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
      23-Jan-2021 19:10:24.786 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-127.0.0.1-9019"]
      23-Jan-2021 19:10:24.788 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
      23-Jan-2021 19:10:24.790 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1132 ms
      23-Jan-2021 19:10:24.796 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
      23-Jan-2021 19:10:24.797 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.57
      Jan 23, 2021 7:10:27 PM org.apache.jasper.servlet.TldScanner scanJars
      INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
      2021-01-23 7:10:27.446 PM INFO  io.fusionauth.api.configuration.DefaultFusionAuthConfiguration - Loading FusionAuth configuration file [/home/elemental/tools/fusionauth/config/fusionauth.properties]
      2021-01-23 7:10:27.463 PM INFO  io.fusionauth.api.configuration.DefaultFusionAuthConfiguration - Dynamically set property [fusionauth-app.url] set to [http://172.31.32.78:9011]
      2021-01-23 7:10:27.464 PM INFO  com.inversoft.configuration.BasePropertiesFileInversoftConfiguration - 
        - Overriding default value of property [database.mysql.enforce-utf8mb4] with value [true]
        - Overriding default value of property [database.mysql.connector-version] with value [8.0.21]
        - Overriding default value of property [fusionauth-app.runtime-mode] with value [development]
        - Overriding default value of property [search.type] with value [database]
      
      2021-01-23 7:10:27.617 PM INFO  io.fusionauth.api.configuration.DefaultFusionAuthConfiguration - Loading FusionAuth configuration file [/home/elemental/tools/fusionauth/config/fusionauth.properties]
      2021-01-23 7:10:27.618 PM INFO  io.fusionauth.api.configuration.DefaultFusionAuthConfiguration - Dynamically set property [fusionauth-app.url] set to [http://172.31.32.78:9011]
      2021-01-23 7:10:27.624 PM INFO  com.inversoft.configuration.BasePropertiesFileInversoftConfiguration - 
        - Overriding default value of property [database.mysql.enforce-utf8mb4] with value [true]
        - Overriding default value of property [database.mysql.connector-version] with value [8.0.21]
        - Overriding default value of property [fusionauth-app.runtime-mode] with value [development]
        - Overriding default value of property [search.type] with value [database]
      
      2021-01-23 7:10:27.953 PM INFO  org.primeframework.mvc.servlet.PrimeServletContextListener - Initializing Prime
      2021-01-23 7:10:27.954 PM INFO  i.f.app.maintenance.guice.FusionAuthInteractiveMaintenanceModeModule - 
      
      ---------------------------------------------------------------------------------------------------------
      --------------------------------------- Entering Maintenance Mode ---------------------------------------
      ---------------------------------------------------------------------------------------------------------
      
      2021-01-23 7:10:28.696 PM INFO  io.fusionauth.api.configuration.DefaultFusionAuthConfiguration - Loading FusionAuth configuration file [/home/elemental/tools/fusionauth/config/fusionauth.properties]
      2021-01-23 7:10:28.698 PM INFO  io.fusionauth.api.configuration.DefaultFusionAuthConfiguration - Dynamically set property [fusionauth-app.url] set to [http://172.31.32.78:9011]
      2021-01-23 7:10:28.700 PM INFO  com.inversoft.configuration.BasePropertiesFileInversoftConfiguration - 
        - Overriding default value of property [database.mysql.enforce-utf8mb4] with value [true]
        - Overriding default value of property [database.mysql.connector-version] with value [8.0.21]
        - Overriding default value of property [fusionauth-app.runtime-mode] with value [development]
        - Overriding default value of property [search.type] with value [database]
      
      2021-01-23 7:10:28.701 PM INFO  com.inversoft.maintenance.MaintenanceModePoller - Poller started to Wait for configuration to be completed.
      Jan 23, 2021 7:12:47 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
      WARNING: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [138,394] milliseconds.
      23-Jan-2021 19:12:47.134 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-9011"]
      23-Jan-2021 19:12:47.149 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["https-jsse-nio-9013"]
      23-Jan-2021 19:12:47.152 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-127.0.0.1-9019"]
      23-Jan-2021 19:12:47.155 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 142364 ms
      2021-01-23 7:13:51.687 PM INFO  io.fusionauth.api.configuration.DefaultFusionAuthConfiguration - Loading FusionAuth configuration file [/home/elemental/tools/fusionauth/config/fusionauth.properties]
      2021-01-23 7:13:51.688 PM INFO  io.fusionauth.api.configuration.DefaultFusionAuthConfiguration - Dynamically set property [fusionauth-app.url] set to [http://172.31.32.78:9011]
      2021-01-23 7:13:51.688 PM INFO  com.inversoft.configuration.BasePropertiesFileInversoftConfiguration - 
        - Overriding default value of property [database.mysql.enforce-utf8mb4] with value [true]
        - Overriding default value of property [database.mysql.connector-version] with value [8.0.21]
        - Overriding default value of property [fusionauth-app.runtime-mode] with value [development]
        - Overriding default value of property [search.type] with value [database]
        - Overriding default value of property [database.mysql.enforce-utf8mb4] with value [true]
        - Overriding default value of property [database.mysql.connector-version] with value [8.0.21]
        - Overriding default value of property [fusionauth-app.runtime-mode] with value [development]
        - Overriding default value of property [search.type] with value [database]
      
      V 1 Reply Last reply Reply Quote 0
      • V
        voidmain @tarun.verghis
        last edited by

        @tarun-verghis Ensure your database is listening on a valid IP and that you have the ability to connect to it using username/password. This is usually configured in the pg_hba.conf file and requires a line like:

        host    all             all             127.0.0.1/32            md5
        

        If you only have lines that say trust then FusionAuth won't be able to connect since it doesn't support local sockets or local connections.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post