我有一个远程 Mysql 服务器,并远程获得了所有权限。这是我从本地计算机远程登录后“显示授权”的输出:
+-------------------------------------------------------------------------------------------------------------+
| Grants for user@% |
+-------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'mysqluser'@'%' IDENTIFIED BY PASSWORD '*B25E737EE2274D7343BF9DCDF6CAF8DB2EAC17E1' |
+-------------------------------------------------------------------------------------------------------------+
但是,当我尝试在本地 rails 环境中使用此服务器时,它会说:
/home/myuser/.rvm/gems/ruby-1.9.3-p429@my_project/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in
connect': Access denied for user 'mysqluser'@'localhost' (using password: YES) (Mysql2::Error) from /home/myuser/.rvm/gems/ruby-1.9.3-p429@my_project/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in
初始化'
这是我的database.yml:
development:
adapter: mysql2
encoding: utf8
reconnect: true
username: mysqluser
password: password
hostname: 192.10.23.114
database: db_name
pool: 5
timeout: 5000
我不明白的是,当我实际使用远程访问时,为什么 Mysql 认为我的用户来自“localhost”?你们对此有什么想法吗?非常感谢。