Reputation: 15079
If I log into the mysql terminal I am able to make any updates or additions to the RDS database that I want to. But when I use Active Record from my rails console, I can only access the data, not update or destroy it.
I seem to have the correct grants:
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX,
ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION
CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT,
TRIGGER ON *.* TO 'root'@'%' IDENTIFIED BY PASSWORD'*XXXXX' WITH GRANT OPTION |
My database.yml looks like:
development:
host: XXXX.YYYY.us-east-1.rds.amazonaws.com
adapter: mysql2
encoding: utf8
reconnect: false
database: filemaker
pool: 5
username: root
password: ZZZZZ
I am getting a return of false now when I attempt to update a record:
>> Section.first.update_column(:craigslist_posts, 1)
Section Load (101.6ms) SELECT `sections`.* FROM `sections` LIMIT 1
SQL (49.9ms) UPDATE `sections` SET `craigslist_posts` = 1 WHERE `sections`.`_id`=
4470
=> false
I have turned whitelist_attributes off thinking that that might have had something to do with it. Because RDS doesn't have any error logs, I can't see if there are any errors being committed.
Upvotes: 0
Views: 590
Reputation: 71424
You cannot use root
user on an RDS, that is reserved for the Amazon service layer. You should reference the RDS "master user" name that you specified when creating the RDS instance. That is your default master user, which has most server-level privileges. See this link for more info on privileges granted to the master user.
Good database practice would have you not using the "root" user or its closest RDS equivalent the "master user" for a specific application. You really should consider defining application-specific users with the appropriate privileges to do only the things the application needs to do.
Upvotes: 1