开发者

rake db:create with mysql on OS X 10.7 Lion fails

I'm trying t开发者_如何学Pythono install rvm, mysql and rails on a fresh OS X 10.7 installation. They all install correctly individually, but I can't seem to get them to work together.

When I try the command rake db:create, I get the following error:

db/test.sqlite3 already exists
db/test.sqlite3 already exists
rake aborted!
uninitialized constant Mysql::Error

Tasks: TOP => db:create
(See full trace by running task with --trace)
  • Mac OS X 10.7.0
  • rvm 1.6.32
  • Ruby 1.9.2
  • MySQL 5.1.5.15
  • Rails 3.0.9

I installed the mysql gem using the correct instructions. I added this to ~/.bash_profile:

export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH"

I did this command:

env ARCHFLAGS="-arch x86_64" sudo gem install mysql -v='2.8.1' -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include --with-mysql-config=/usr/local/mysql/bin/mysql_config

When I do gem list, I can see that version 2.8.1 of the mysql gem is installed. I've kinda run out of ideas now, any suggestions? Thanks.

database.yml:

development:
  adapter: mysql
  encoding: utf8
  reconnect: false
  database: terra_development
  pool: 5
  username: root
  password: root
  socket: /tmp/mysql.sock


thanks for the input, I managed to fix the problem. The problem was that rails couldn't connect with the server using the provided credentials. Because for some reason, there weren't any MySQL users, not even a root user. I ran this command:

/usr/local/mysql/bin/mysqladmin -u root password "root"

Which created a root user, let me connect to the server and fixed the problem!


The sqlite error is while creating the test database. You show the development section of your database.yml, so either your test section of database.yml specifies sqlite or you don't have a test database specified.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜