Database connection faults when I use the server IP address

I have Ignition (8.1.22) installed on a small partition of a server called opc0. My databse (MySQL) resides on the same server, but on a different, larger partition.

I want to make the database discoverable by my redudant gateway on a different server opc1, but I'm using localhost in the host section of the connection URL: jdbc:mysql://localhost:3306/tagDB. With the connection string as is, the connection works fine. If I change the host to use the server's IP address, jdbc:mysql://10.20.32.16:3306/tagDB, the connection faults with the following error:

java.sql.SQLException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'10.20.32.16' (using password: YES)) at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:656) at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:534) at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:734) at com.inductiveautomation.ignition.gateway.datasource.DatasourceImpl.getConnectionInternal(DatasourceImpl.java:300) at com.inductiveautomation.ignition.gateway.datasource.DatasourceImpl.runTest(DatasourceImpl.java:253) at com.inductiveautomation.ignition.gateway.datasource.DatasourceManagerImpl$FaultedDatasourceRetryer.lambda$newRetryRunnable$0(DatasourceManagerImpl.java:1096) at com.inductiveautomation.ignition.common.execution.impl.BasicExecutionEngine$TrackedTask.run(BasicExecutionEngine.java:587) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) Caused by: java.sql.SQLException: Access denied for user 'root'@'10.20.34.16' (using password: YES) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:828) at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:448) at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:241) at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) at org.apache.commons.dbcp2.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:52) at org.apache.commons.dbcp2.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:357) at org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:103) at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:652) ... 12 more

I don't understand why I'm losing access permissions when the only thing that changes is the host.

MySQL disallows root access from anything but localhost by default. Sounds like you need to make some configuration changes.

2 Likes

Thanks! I created a new user specifically for Ignition in MySQL, granted it priveleges, and changed the host in my database URL.

Hi Kevin,
I'm getting the same thing for PostgreSQL on v8.1.44. Suggestions?
Thank you.

PostgreSQL uses pg_hba.conf to configure what kinds of connections are allowed, and from what address ranges. It does not attach hostname/IP metadata to the user accounts.

Thank you Phil!