Where is my db file?

I've created a db. Well... running 'rails console' and testing for
the existence of users and other resources works, so I'd infer that my
db has been created. But it's not in my db directory, or in the root
directory... where could it be?

I recently tried getting mysql2 to work with my rails 3.0.3 app. I'm
on windows, and ever since the switch from sqlite3 to mysql2 (I
changed my database.yml to look like below) I've gotten this
confusion.
Even worse, now when I run 'rails server' the page literally takes
forever to load!! Hitting ctrl + c to stop the server makes the cmd
say "going to shutdown ..." but it never does, so I have to manually
close the window and reopen the command line.

Any insights would be greatly appreciated!!!

-database.yml-

development:
  adapter: mysql2
  encoding: utf8
  database: development
  pool: 5
  timeout: 5000
  username: root
  password: admin
  socket: /tmp/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: mysql2
  encoding: utf8
  reconnect: false
  database: test
  username: root
  password: admin
  #pool: 5
  #timeout: 5000

production:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: blog3_development
  pool: 5
  username: root
  password: admin
  socket: /var/run/mysqld/mysqld.sock

Oh I just opened my HeidiSQL program and found that all these
databases an be found there! All the tables and stuff can be viewed
there...how nice. Except...I still don't understand WHERE these dbs
are....how does mysql2 handle them? How come they're not found in my
application when I look through all my directories e.g. db, config,
app, etc.? It bothers me...

And I guess the more pressing issue now is WHY rails server goes so
slowwwwwww! Is it possible that too many dbs can make it that way?

So basically 1) why is rails server so slow/not working and 2) WHERE
are these dbs on my computer REALLY and how come they're not in my
app's directory?

daze wrote in post #966105:

I've created a db. Well... running 'rails console' and testing for
the existence of users and other resources works, so I'd infer that my
db has been created. But it's not in my db directory, or in the root
directory... where could it be?

It's in MySQL's data directory, the location of which is set in your
MySQL configuration. SQLiite works fundamentally differently from most
other DBs, in that it puts the whole DB in a single file, which is nice
and portable, but runs into concurrency issues. MySQL and other DBs
locate all DBs centrally, and use multiple files to represent one DB.

You normally shouldn't need to worry about where your MySQL DBs live.

Best,

Hello,

as I know this is true about DBs. And one more thing about it: if you
keep your migrating files, then you can easily migrate on your server
later, and it will create all the databases for you, so it won't be
problem if you have another type of DB in production then development.

Try this: gem install thin (or gem install mongrel also good),
then write it to your Gemfile: gem 'thin',
then from command line: 'rails server -thin'
it will be faster then Webrick, the default server.

Good luck,
Zoltán

Thanks!!! This is really helpful - it makes sense now.

I'm trying this right now, but I can't install thin - or I can't get
it working. I'm on Windows by the way, so I realized from
http://groups.google.com/group/thin-ruby/browse_thread/thread/c15b2472eb97c2ba
that I need eventmachine -v0.8.1 which I have installed (or at least
it appears when I type "gem list").

Gem list also says that I have "thin (1.2.7 x86-mingw32)" so I should
have thin now too.

HOWEVER, after adding
gem 'eventmachine', '0.8.1'
gem 'thin'
to the gemfile and running bundle update, I get this error:

I don't recommend using mysql2 gem right now. It still has many
problems, especially with (invalid date) in numerous cases. I use the
normal mysql gem right now with windows and rails 3.0.3 and ruby 1.9.2.

You can use that gem by doing:

gem install mysql --source http://gems.rubyinstaller.org

(because you are windows and developing in windows)

You also have to replace mysql2 in the database.yml with mysql for the
adpater types. I also specify mysql in my Gemfile and then run bundle
install.

There are numerous issues still at large for mysql2.
https://github.com/brianmario/mysql2/issues

Also I recommend using mongrel as well.
Place => gem 'mongrel', '>= 1.2.0.pre2'
.. in your Gemfile
# used with Ruby 1.9.2 on Windows (no other files necessary)
# use bundle install to install mongrel
# once mongrel is installed use "rails server" not "mongrel_rails start"
to start your server.

I develop many rails apps on Windows, Linux, and Mac. I like being
familiar with all of the environments. Windows is by far the most
difficult to setup and use with Ruby and RoR, but there are some
advantages with Windows installations (Windows 7 especially) that you
don't get with the other OSs. It involves invoking PowerShell
scripting. But, that's another disussion entirely.

Good luck.

er one correction - gem install mysql (not with the --sources).

Hey thanks! I'll try mysql instead and hope that the server will work
better...
what a pity that mysql2 isn't so stable.

Wait com'on there must be a way to get this mysql2 database to work
quickly with rails server....
And I've never come across the invalid date error you described.
Something...maybe???

Well, in the end, I've decided to only have mysql2 for production.
For development, I have sqlite3...it's just so "rails server" can work.

daze wrote in post #969350:

Well, in the end, I've decided to only have mysql2 for production.
For development, I have sqlite3...it's just so "rails server" can work.

You're going to want to get this working properly. At some point,
you'll want to use something other than SQLite for development.

Best,