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.
# 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
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?
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.
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.
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.
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.
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???