简体   繁体   English

`socket`声明在Rails应用程序的database.yml文件中做什么?

[英]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.

相关问题 Ruby on Rails database.yml中的socket声明是什么? - What is the socket declaration for, in Ruby on Rails database.yml? 正确 Ruby on Rails Database.yml 文件的 MySQL 配置 - Correct MySQL configuration for Ruby on Rails Database.yml file Rails - 具有单个源和database.yml文件的多个开发实例 - Rails - Multiple development instances with a single source and database.yml file Rails正在寻找未由database.yml指定的数据库 - Rails looking for a databases not specified by database.yml 如何管理Rails database.yml - How to manage Rails database.yml database.yml中pool选项的用途是什么 - what is the use of the pool option in database.yml 缺少项目中的database.yml文件 - Missing database.yml file in a project 为什么某些Rails项目使用具有不同扩展名(mysql,postgresql等)的多个database.yml文件? - Why do some Rails projects use multiple database.yml files with different extensions (mysql, postgresql etc)? 如何正确使用database.yml文件从MySQL连接到Ruby on rails? - How to connect from MySQL to Ruby on rails using database.yml file properly? Docker + Rails + MySQL = 忽略 database.yml 中的环境变量 - Docker + Rails + MySQL = Ignoring environment variables in database.yml
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM