[英]What mysql client to run with Rails / Mac OS X?
I'm trying to learn how to use mysql with a rails app. 我正在尝试学习如何在Rails应用程序中使用mysql。 I installed mysql with Homebrew (brew install mysql), and I don't understand how to run a mysql server or client (what that means, entails, or anything).
我用Homebrew安装了mysql(安装了brew安装mysql),但我不明白如何运行mysql服务器或客户端(这意味着,需要执行任何操作)。
My OS is Mac OS Snow Leopard. 我的操作系统是Mac OS Snow Leopard。
How do I run a mysql server or client? 如何运行mysql服务器或客户端? I just want to get something functioning so I can do rake db:create, create my development database, and get my app up and running so I can create models, tables, and essentially develop without hassle.
我只想让某些功能起作用,所以可以执行db:create,创建我的开发数据库,并使我的应用程序启动并运行,这样我就可以创建模型,表,并且基本上可以轻松进行开发。
Thanks for any and all help. 感谢您提供的所有帮助。
您可以使用安装程序http://mysql.com/downloads/mysql/#downloads安装mysql,如果需要的话,它包括用于启动/停止和自动运行程序的设置应用程序。
Run mysqld in terminal, that should do it. 在终端中运行mysqld,应该这样做。 As:
如:
$ mysqld
The default for starting your mysqlserver is mysql.server start
. 启动mysqlserver的默认值为
mysql.server start
。 This will create a socket at: /tmp/mysql.sock
这将在
/tmp/mysql.sock
创建一个套接字。
A example config for a development mysql database would be (defined in database.yml
): 开发mysql数据库的示例配置将是(在
database.yml
定义):
development:
adapter: mysql2
encoding: utf8
database: rails_app_development
username: root
password:
socket: /tmp/mysql.sock
pool: 5
timeout: 5000
You will need to include the mysql2 gem in your Gemfile: gem 'mysql2'
您将需要在Gemfile中包含mysql2 gem:gem'mysql2
gem 'mysql2'
For setting up a fast development environment it is fine to just go with sqlite3 and sort the connection with another database later. 为了建立一个快速的开发环境,最好只使用sqlite3并稍后对与另一个数据库的连接进行排序。
I can recommend the Sequel Pro editor for connecting to your DB and viewing the data and create/edit/remove of databases and objects. 我可以推荐Sequel Pro编辑器来连接到数据库并查看数据,以及创建/编辑/删除数据库和对象。
Here you go: 干得好:
Server: http://mysql.com/downloads/mysql/#downloads 服务器: http : //mysql.com/downloads/mysql/#downloads
Client: http://www.mysql.com/products/workbench/ 客户端: http : //www.mysql.com/products/workbench/
After install it you will find start/stop controls in OS X System Preferences 安装后,您将在OS X系统偏好设置中找到启动/停止控件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.