gpt4 book ai didi

mysql - 氮气.io :moving rails app to mysql

转载 作者:太空宇宙 更新时间:2023-11-03 16:03:19 25 4
gpt4 key购买 nike

我需要将我的应用程序从 sqlite 迁移到 mysql。我遵循了那个指南

http://help.nitrous.io/mysql/

安装好mysql,这是我的yaml文件

developement:
adapter: mysql2
encoding: utf8
database: dev-db
pool: 5
timeout: 5000

test:
adapter: mysql2
encoding: utf8
database: test-db
pool: 5
timeout: 5000

production:
adapter: mysql2
encoding: utf8
database: prod-db
pool: 5
timeout: 5000

当我尝试执行 rake db:create 时出现此错误

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "database"=>"test-db", "pool"=>5, "timeout"=>5000}, charset: utf8, collation: utf8_unicode_ci
(if you set the charset manually, make sure you have a matching collation)

我需要做什么?

最佳答案

你需要在database.yml中添加一个socket

获取套接字:

mysqladmin variables | grep socket

这让我在我的系统 (OSX) 上:

socket: /tmp/mysql.sock

在 Linux 上:

socket: /var/run/mysqld/mysqld.sock

关于mysql - 氮气.io :moving rails app to mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19861542/

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