Search code examples
mysqldockerdocker-composejruby

Docker ActiveRecord::JDBCError Access denied for user 'wfc'@'172.19.0.7' (using password: YES)


I have an issue with my db connection in jRuby on Rails app using Docker mysql container.

All containers are up and I can access to db with:

docker exec -it wfc-mysql bash 
root@4223fcd44ca0:/# mysql -u root -p

mysql> select user,host from mysql.user;
+------+-----------+
| user | host      |
+------+-----------+
| root | %         |
| root | localhost |
| wfc  | localhost |
+------+-----------+
3 rows in set (0.00 sec)

However, accessing my page on localhost:3000 I am getting the error:

ActiveRecord::JDBCError
Access denied for user 'wfc'@'172.19.0.7' (using password: YES)
Rails.root: /app

I tried a lot of solutions from stackoverflow and still no progress.

Not even know how the app gets this user 'wfc'@'172.19.0.7' (i tried later to create one in db). Nothings changed.

This is my database.yml for dev db:

development: &development
  adapter: mysql2
  encoding: utf8
  database: wfc
  pool: 25
  username: wfc
  password: sabanxxx
  host: localhost
  reconnect: false

Solution

  • I had a problem with missing some external file which was necessary for running the project.

    So, this problem was nothing general in my case its some internal project dependency.

    NOTE: You should check projects README.md in details and implement all requirements before you try to solve this kind of error.

    Thank you!