简体   繁体   English

与Rails中的远程计算机的数据库连接

[英]Database connection to remote machine in ruby on rails

Here is strange problem. 这是一个奇怪的问题。

databse server ip : 170.2.14.131 数据库服务器ip:170.2.14.131

application server ip : 170.2.14.137 应用程序服务器ip:170.2.14.137

Application is on cloud server. 应用程序在云服务器上。 Database server is on another instance and application hosted on different instance. 数据库服务器位于另一个实例上,而应用程序位于另一个实例上。

production:
  adapter: mysql
  database: database_name
  username: ************
  password: ************
  host: 170.2.14.131

This is my database.yml configuration for production environment. 这是我用于生产环境的database.yml配置。

Now when i am trying to connect through my application it's using application server IP instead of remote databse IP. 现在,当我尝试通过应用程序进行连接时,它使用的是应用程序服务器IP,而不是远程数据库IP。

Please suggest. 请提出建议。

By default, MySQL database server remote access disabled for security reasons. 默认情况下,出于安全原因,MySQL数据库服务器的远程访问被禁用。 there're 3 solutions to this problem, i'll not describe them here, you can read about it in my blog here: http://notes.kloop.kg/2011/11/17/enable-remote-access-to-mysql-database-server/ 对于此问题,有3种解决方案,在此不再赘述,您可以在我的博客中阅读: http : //notes.kloop.kg/2011/11/17/enable-remote-access-to -mysql-database-server /

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM