0

Using Rails 3.2, mysql2 gem, MariaDB 5.5. I got the following error while trying to deploy the app for the first time:

Mysql2::Error: Access denied for user 'abc'@'%' to database 'app_production'

I'm not sure why the percent sign % in 'abc'@'%'.

Here's my database.yml:

production:
  adapter: mysql2
  encoding: utf8
  reconnect: true
  host: db.domain.com
  port: 3306
  database: app_production
  pool: 5
  username: abc
  password: some_password_here
  socket: /run/mysqld/mysqld.sock

My /etc/mysql/my.cnf has bind 0.0.0.0, firewall is temporarily disabled with sudo iptables -F.

1

2 Answers 2

1

This error due to permission on database access for the user, so you have to grant access permission for this user on above database. Find below command to grant permission. run these command on mysql terminal

GRANT ALL PRIVILEGES ON app_production.* TO 'abc'@'%'  WITH GRANT OPTION
FLUSH PRIVILEGES
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. I replace the wildcard % with ip_address instead.
-1

It sounds like the user abc is not set up with MySQL. Go to your MySQL client and make sure that user is created (with that database).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.