[英]What does the `socket` declaration do in the database.yml file of a rails app?
I have downloaded a database to my desktop (I am using OSX) 我已将数据库下载到桌面上(我正在使用OSX)
I need to create rails app that uses this database, I am sorry if this question is so simple I am new to rails! 我需要创建使用此数据库的Rails应用,如果这个问题如此简单,我很陌生,对不起! I think that this
socket:
is the path to the database, is this correct? 我认为这个
socket:
是数据库的路径,对吗?
development:
adapter: mysql2
encoding: utf8
database: ttlem_demo_development
pool: 5
username: root
password:
socket: /tmp/mysql.sock
Your file seems to be correct. 您的文件似乎正确。 If you want to connect on localhost, you'll need to add this line
如果要在localhost上连接,则需要添加此行
hostname: 127.0.0.1
to your file. 到您的文件。
Note that the database.yml you provide contains only a section for development. 请注意,您提供的database.yml仅包含用于开发的部分。 You can add other section like 'test' or 'production'.
您可以添加其他部分,例如“测试”或“生产”。 You can see an example here .
您可以在此处查看示例 。
I also found a good explanation of a socket here . 我还发现一个插座的一个很好的解释在这里 。 Hope that will help you.
希望对您有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.