[Solved] Problem connecting to redmine in local. Error 500 with "Activerecord::connectionnotestablished"
Added by lmn06 C about 1 year ago
Hello,
My config:One synology NAS with container manager running one Mysql container and one Redmine container (in the same subnet):
- Ruby : ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [x86_64-linux]
- Rails : Rails 6.1.7.6
- Operating system : Windows 10 with container manager.
- Database: Mysql version 5.7
- Ruby-aware server used: Puma version 6.4.0
My config/database.yml :
production:
adapter: "mysql2"
host: "db"
port: "3306"
username: "root"
password: "*****"
database: "redmine"
My problem:
When I try to connect me to http://my-ip:port I have an error 500.
And in the log : "Activerecord::connectionnotestablished (access denied for user 'root'@'ip' (using password:YES))."
But in mysql, I can connect me to the db with user root and his password.
- Change host to localhost, 127.0.0.1,... Just the message in the log change but the error 500 stay.
- Grant privileges to Mysql DB. Nothing change.
- Add "socket : /var/run/mysqld/mysqld.sock" in the config/database.yml Just the message in the log change but the error 500 stay.
- Change the nameserver in the file /etc/resolv.conf.
Someone can help me with this error ?
Thanks you,
Replies (6)
RE: Problem connecting to redmine in local. Error 500 with "Activerecord::connectionnotestablished" - Added by C S about 1 year ago
Do you have one engine for Redmine and another for MySQL? Then the database cannot be accessed locally from Redmine, but only via the Synology IP...
RE: Problem connecting to redmine in local. Error 500 with "Activerecord::connectionnotestablished" - Added by lmn06 C about 1 year ago
C S wrote in RE: Problem connecting to redmine in local. Error 500 wit...:
Do you have one engine for Redmine and another for MySQL? Then the database cannot be accessed locally from Redmine, but only via the Synology IP...
C S Yes I have one engine with redmine and another with MySql. They are in the same subnet, in the same machine. Unfortunately the ping command doesn't work on my containers so I can't test the connectivity between them.
RE: Problem connecting to redmine in local. Error 500 with "Activerecord::connectionnotestablished" - Added by C S about 1 year ago
My solution (works for me):
- Redmine runs via Docker - I have set the network bridge to manual - the subnet to the NAS is 172.17.0.0/16, the gateway is 172.17.0.1
- Synology assigns the IP 172.17.0.2 to Redmine
- The database runs in the integrated MariaDB app without an additional container
- So the DB_HOST is 172.17.0.1 on port 3307
RE: Problem connecting to redmine in local. Error 500 with "Activerecord::connectionnotestablished" - Added by lmn06 C about 1 year ago
C S Thanks to your answer. You've made me realize that the problem might be my IP configuration. My Synology is on IP 192.168.x.x while my containers are on bridge on 172.23.0.x.
And I will try with MariaDB app too.
RE: Problem connecting to redmine in local. Error 500 with "Activerecord::connectionnotestablished" - Added by lmn06 C about 1 year ago
C S Thanks you so much to your help. It's finally works with redmine on one container and with the app MariaDB.
My config : One Nas on 192.168.x.x and a subnet to redmine in 172.17.x.x
RE: [Solved] Problem connecting to redmine in local. Error 500 with "Activerecord::connectionnotestablished" - Added by C S about 1 year ago
I'm glad I could help you