我正在使用Upsert gem和Rails 4.2.1以及mysql2 gem v0.3.18。但是每当我尝试插入任何东西时,我都会收到“拒绝访问”错误。
例如:
upsert = Upsert.new User.connection, User.table_name
似乎工作正常。
但是当我真的尝试使用Upsert时,就像这样:
upsert.row({id: 123}, name: 'Neat')
我收到此错误:
Mysql2::Error: Access denied for user 'developer'@'%' to database 'project_development'
from /usr/local/rvm/gems/ruby-2.2.0@project/gems/upsert-2.1.0/lib/upsert/connection/Mysql2_Client.rb:7:in `query'
from /usr/local/rvm/gems/ruby-2.2.0@project/gems/upsert-2.1.0/lib/upsert/connection/Mysql2_Client.rb:7:in `execute'
from /usr/local/rvm/gems/ruby-2.2.0@project/gems/upsert-2.1.0/lib/upsert/merge_function/mysql.rb:28:in `create!'
from /usr/local/rvm/gems/ruby-2.2.0@project/gems/upsert-2.1.0/lib/upsert/merge_function.rb:39:in `initialize'
from /usr/local/rvm/gems/ruby-2.2.0@project/gems/upsert-2.1.0/lib/upsert.rb:229:in `new'
from /usr/local/rvm/gems/ruby-2.2.0@project/gems/upsert-2.1.0/lib/upsert.rb:229:in `merge_function'
from /usr/local/rvm/gems/ruby-2.2.0@project/gems/upsert-2.1.0/lib/upsert.rb:218:in `row'
我之前使用过PostgreSQL使用Upsert,它运行得很漂亮。有没有其他人在使用MySQL和Upsert之前看到过这个错误,如果有的话,你有什么建议吗?
答案 0 :(得分:1)
希望这有助于其他人......但事实证明,"开发人员"用户没有该MySQL数据库的 CREATE PROCEDURE 权限。
将这些权限授予"开发人员"用户,事情只是膨胀。