我有一个在 Fedora 20 上针对 Apache 和 mysql (Maria db) 运行的 Rails 应用程序 在最近更新 Fedora 之前它没有任何问题,之后 passanger 因此错误而失败
Web application could not be started
Access denied for user 'user'@'localhost' to database 'TheDB' (Mysql2::Error)
使用 WEBrick 从命令行运行 Rails 工作正常,也可以使用
连接到 mysqlmysql -u user -h loalhost m -p
重新安装乘客和 mysql2 gem 没有帮助
经过几个小时的解决这个问题后,我完全不知道还能尝试什么
我欢迎任何想法
最佳答案
如果您可以从命令行使用正确的用户名和密码进行连接,但您的脚本无法使用相同的凭据进行连接,请检查数据库 mysql、表 user 的主机列中的正确值。
SELECT Host FROM mysql.user WHERE User='myusername';
来自http://dev.mysql.com/doc/refman/5.1/en/connection-access.html :
Identity checking is performed using the three user table scope columns (Host, User, and Password). The server accepts the connection only if the Host and User columns in some user table row match the client host name and user name and the client supplies the password specified in that row.
检查是否 sorting rules不会影响您:
The server uses the first row that matches the client host name and user name.
关于mysql - Rails Passenger 和 mysql 拒绝用户访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21311569/