gpt4 book ai didi

mysql 错误帮助... 运行 rake db :setup RAILS_ENV ="production" 时

转载 作者:行者123 更新时间:2023-11-29 02:35:13 25 4
gpt4 key购买 nike

我正在努力为我的第一个 Rails 应用启动并运行 mysql。运行 rake db:setup RAILS_ENV="production"时,我不断收到以下错误:

rake aborted!
dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dyl Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2 /mysql2.bundle
/Users/chris/rails_projects/sienab/Rakefile:4
(See full trace by running task with --trace)

我正在运行雪豹、mysql 5.5、gem mysql2、rails 3。

任何帮助都很棒。非常感谢。

下面的database.yml # SQLite 版本 3.x # gem 安装 sqlite3 发展: 适配器:sqlite3 数据库:db/development.sqlite3 游泳池:5 超时: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
pool: 5
timeout: 5000

production:
adapter: mysql2
encoding: utf8
reconnect: false
database: sienab_production
pool: 5
username: username
password: password
host: localhost

最佳答案

看起来您需要安装 mysql2 库:

sudo apt-get install libmysqlclient-dev libmysqlclient16

此外,如果您使用的是 Rails 3.0.x,我建议您在 Gemfile 中使用 gem 'mysql2','0.2.7'。不要忘记在进行此更改后运行 bundle install

关于mysql 错误帮助... 运行 rake db :setup RAILS_ENV ="production" 时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6243475/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com