我要用ruby on rails连接Mysql,可是总是不行 20
我在网上看了大量资料,什么libmysql.dll,ruby.mysql的驱动都装好了,而且单用ruby项目也就是拿一个ruby文件来连mysql却是相当成功!!当我创建...
我在网上看了大量资料,什么libmysql.dll,ruby.mysql的驱动都装好了,而且单用ruby项目也就是拿一个ruby文件来连mysql却是相当成功!!
当我创建一个新项目时(我用的是RadRails IDE),选中连接mysql并出现欢迎界面后,点击About your application’s environment时本应出现我的项目的相关信息,可结果总是出现:We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it shortly.
但每次创建新项目时数据库选则sqlite就没问题,我mysql已经安好了啊,这rails到底如何才能连上mysql啊,都折腾一周了,急! 展开
当我创建一个新项目时(我用的是RadRails IDE),选中连接mysql并出现欢迎界面后,点击About your application’s environment时本应出现我的项目的相关信息,可结果总是出现:We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it shortly.
但每次创建新项目时数据库选则sqlite就没问题,我mysql已经安好了啊,这rails到底如何才能连上mysql啊,都折腾一周了,急! 展开
展开全部
首先检查一下你的mysql服务打开没有
你再检查一下/config/database.yml
项目默认的好像是链接sqlite3
默认值
# SQLite version 3.x
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: sqlite3
database: db/development.sqlite3
timeout: 5000
# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
timeout: 5000
-----------------------
mysql应该的是
# SQLite version 3.x
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: mysql
database: 项目的数据库名
username: root
password: 你的密码
socket: /path/to/your/mysql.sock
# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
adapter: mysql
database: 项目的数据库名
username: root
password: 你的密码
socket: /path/to/your/mysql.sock
production:
adapter: mysql
database: 项目的数据库名
username: root
password: 你的密码
socket: /path/to/your/mysql.sock
你再检查一下/config/database.yml
项目默认的好像是链接sqlite3
默认值
# SQLite version 3.x
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: sqlite3
database: db/development.sqlite3
timeout: 5000
# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
timeout: 5000
-----------------------
mysql应该的是
# SQLite version 3.x
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: mysql
database: 项目的数据库名
username: root
password: 你的密码
socket: /path/to/your/mysql.sock
# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
adapter: mysql
database: 项目的数据库名
username: root
password: 你的密码
socket: /path/to/your/mysql.sock
production:
adapter: mysql
database: 项目的数据库名
username: root
password: 你的密码
socket: /path/to/your/mysql.sock
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询