Hi, Just trying to get my first database based rails app up on dreamhost.com. The app was working prior to putting in mysql DB usage but I''m just stuck on getting the app working with mysql. I''ve already created the database and can connect to it manually. Below is the error I get after running the rake migrate. It worked OK on my home PC environment. I did change the enviroment to "test" on the dreamhost.com site. Any ideas? ERROR OUTPUT ========= [skybar]$ rake db:migrate --trace (in /home/.granger/callagga/testapp.gregnet.org) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate rake aborted! Can''t connect to local MySQL server through socket ''/var/run/mysqld/mysqld.sock'' (2) /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:331:in `real_connect'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:331:in `connect'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:88:in `initialize'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:37:in `new'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:37:in `mysql_connection'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:251:in `send'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:251:in `connection_without_query_cache='' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/query_cache.rb:54:in `connection='' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:220:in `retrieve_connection'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in `connection'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/migration.rb:281:in `migrate'' /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/tasks/databases.rake:4 /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/tasks/databases.rake:3:in `call'' /usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute'' /usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `each'' /usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute'' /usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in `invoke'' /usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `synchronize'' /usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke'' /usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'' /usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `each'' /usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'' /usr/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7 /usr/bin/rake:18:in `load'' /usr/bin/rake:18 CUT FROM ENVIRONMENT.RB =================ENV[''RAILS_ENV''] ||= ''test'' thanks in advance Greg -- Posted via http://www.ruby-forum.com/.
On 7/23/06, Greg Hauptmann <gregsfm@tpg.com.au> wrote:> Just trying to get my first database based rails app up on > dreamhost.com. The app was working prior to putting in mysql DB usage > but I''m just stuck on getting the app working with mysql. I''ve already > created the database and can connect to it manually. > > Below is the error I get after running the rake migrate. It worked OK > on my home PC environment. I did change the enviroment to "test" on the > dreamhost.com site. > > Any ideas? > > ERROR OUTPUT > =========> > [skybar]$ rake db:migrate --trace > (in /home/.granger/callagga/testapp.gregnet.org) > ** Invoke db:migrate (first_time) > ** Invoke environment (first_time) > ** Execute environment > ** Execute db:migrate > rake aborted! > Can''t connect to local MySQL server through socket > ''/var/run/mysqld/mysqld.sock'' (2)Have you checked that that is where the MySQL socket is? Sincerely, Tom Lieber http://AllTom.com/ http://GadgetLife.org/
Greg Hauptmann
2006-Jul-23 21:37 UTC
[Rails] Re: help with "rake db:migrate" error please?
Tks for replying Tom, Do you mind if I ask what you mean here - I have to admit I''m a windows person mainly :( Tks Greg Tom Lieber wrote:> On 7/23/06, Greg Hauptmann <gregsfm@tpg.com.au> wrote: >> >> Can''t connect to local MySQL server through socket >> ''/var/run/mysqld/mysqld.sock'' (2) > > Have you checked that that is where the MySQL socket is? > > Sincerely, > > Tom Lieber > http://AllTom.com/ > http://GadgetLife.org/-- Posted via http://www.ruby-forum.com/.
Tom, I think your database.yml is misconfigured. It should not use It should look exactly like this, which connects to MySQL over a TCP connection: production: adapter: mysql database: your_db username: your_username password: your_password host: yourdb.yourhostname.com port: 3306 - dan -- Dan Kohn <mailto:dan@dankohn.com> <http://www.dankohn.com/> <tel:+1-415-233-1000> On Jul 23, 2006, at 2:18 PM, Tom Lieber wrote:> On 7/23/06, Greg Hauptmann <gregsfm@tpg.com.au> wrote: >> Just trying to get my first database based rails app up on >> dreamhost.com. The app was working prior to putting in mysql DB >> usage >> but I''m just stuck on getting the app working with mysql. I''ve >> already >> created the database and can connect to it manually. >> >> Below is the error I get after running the rake migrate. It >> worked OK >> on my home PC environment. I did change the enviroment to "test" >> on the >> dreamhost.com site. >> >> Any ideas? >> >> ERROR OUTPUT >> =========>> >> [skybar]$ rake db:migrate --trace >> (in /home/.granger/callagga/testapp.gregnet.org) >> ** Invoke db:migrate (first_time) >> ** Invoke environment (first_time) >> ** Execute environment >> ** Execute db:migrate >> rake aborted! >> Can''t connect to local MySQL server through socket >> ''/var/run/mysqld/mysqld.sock'' (2) > > Have you checked that that is where the MySQL socket is? > > Sincerely, > > Tom Lieber > http://AllTom.com/ > http://GadgetLife.org/ > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Greg Hauptmann
2006-Jul-23 23:03 UTC
[Rails] Re: help with "rake db:migrate" error please?
tks Dan - it was acutally me with the issue It seems I can''t get ftp or ssh access to dream host from work at the moment, however I don''t remember seeing a "port" entry in my config file. If I had omitted this would this explain the error? (I just adjusted the out of the box rails settings, and I used the "TEST" environment, as I still want to be dynamic for testing changes but did not want to use DEVELOPMENT so I could still test on my local PC at home without having to change things. So if the PORT line isn''t in the standard TEST entry in database.yml out of the box from rails then I wouldn''t have had it in at dreamhost) Dan Kohn wrote:> Tom, I think your database.yml is misconfigured. It should not use > It should look exactly like this, which connects to MySQL over a TCP > connection: > > production: > adapter: mysql > database: your_db > username: your_username > password: your_password > host: yourdb.yourhostname.com > port: 3306 > > > - dan > -- > Dan Kohn <mailto:dan@dankohn.com> > <http://www.dankohn.com/> <tel:+1-415-233-1000>-- Posted via http://www.ruby-forum.com/.
I suspect your problem has to do with the test database being special. It''s designed to be replicated from the development database schemas and populated with fixtures when you run tests. Try creating a forth entry in your database.yml called server-devel and see if you can get that set up correctly. - dan -- Dan Kohn <mailto:dan@dankohn.com> <http://www.dankohn.com/> <tel:+1-415-233-1000> On Jul 23, 2006, at 4:03 PM, Greg Hauptmann wrote:> tks Dan - it was acutally me with the issue > > It seems I can''t get ftp or ssh access to dream host from work at the > moment, however I don''t remember seeing a "port" entry in my config > file. If I had omitted this would this explain the error? > > (I just adjusted the out of the box rails settings, and I used the > "TEST" environment, as I still want to be dynamic for testing changes > but did not want to use DEVELOPMENT so I could still test on my > local PC > at home without having to change things. So if the PORT line isn''t in > the standard TEST entry in database.yml out of the box from rails > then I > wouldn''t have had it in at dreamhost) > > Dan Kohn wrote: >> Tom, I think your database.yml is misconfigured. It should not use >> It should look exactly like this, which connects to MySQL over a TCP >> connection: >> >> production: >> adapter: mysql >> database: your_db >> username: your_username >> password: your_password >> host: yourdb.yourhostname.com >> port: 3306 >> >> >> - dan >> -- >> Dan Kohn <mailto:dan@dankohn.com> >> <http://www.dankohn.com/> <tel:+1-415-233-1000> > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Greg Hauptmann
2006-Jul-24 01:17 UTC
[Rails] Re: Re: help with "rake db:migrate" error please?
Dan - I''ve been looking for the syntax/documentation for database.yml so I can firm up my understanding of what you''re suggesting. Can you give any pointers off hand for where I should look for this? tks greg Dan Kohn wrote:> I suspect your problem has to do with the test database being > special. It''s designed to be replicated from the development > database schemas and populated with fixtures when you run tests. Try > creating a forth entry in your database.yml called server-devel and > see if you can get that set up correctly. > > - dan > -- > Dan Kohn <mailto:dan@dankohn.com> > <http://www.dankohn.com/> <tel:+1-415-233-1000>-- Posted via http://www.ruby-forum.com/.
Greg Hauptmann
2006-Jul-24 01:30 UTC
[Rails] Re: Re: help with "rake db:migrate" error please?
Actually I''ve just found some info in the Rails API guide (see below). I''m guessing what is required is the ":socket" option entry to be setup as follows: socket: /var/run/mysqld/mysqld.sock Or actually I''m not sure if this (from the error log) is the incorrect location that my app was trying, or whether it was the correct one? If it were the incorrect location then I guess I need to find out where Dreamhost has the mysqld.sock file located? Will try this once I get home. =============The MySQL adapter will work with both Ruby/MySQL, which is a Ruby-based MySQL adapter that comes bundled with Active Record, and with the faster C-based MySQL/Ruby adapter (available both as a gem and from www.tmtm.org/en/mysql/ruby/). Options: * :host ? Defaults to localhost * :port ? Defaults to 3306 * :socket ? Defaults to /tmp/mysql.sock * :username ? Defaults to root * :password ? Defaults to nothing * :database ? The name of the database. No default, must be provided. * :sslkey ? Necessary to use MySQL with an SSL connection * :sslcert ? Necessary to use MySQL with an SSL connection * :sslcapath ? Necessary to use MySQL with an SSL connection * :sslcipher ? Necessary to use MySQL with an SSL connection ============= -- Posted via http://www.ruby-forum.com/.
AWDWR chapters 6 & 13, plus read about YAML. If you''re still having problems, you might consider editing the database.yml from a fresh rails install (rails temp), as things like spurious tabs can be hard to debug. - dan -- Dan Kohn <mailto:dan@dankohn.com> <http://www.dankohn.com/> <tel:+1-415-233-1000> On Jul 23, 2006, at 6:17 PM, Greg Hauptmann wrote:> Dan - I''ve been looking for the syntax/documentation for > database.yml so > I can firm up my understanding of what you''re suggesting. Can you > give > any pointers off hand for where I should look for this? > > tks > greg > > Dan Kohn wrote: >> I suspect your problem has to do with the test database being >> special. It''s designed to be replicated from the development >> database schemas and populated with fixtures when you run tests. Try >> creating a forth entry in your database.yml called server-devel and >> see if you can get that set up correctly. >> >> - dan >> -- >> Dan Kohn <mailto:dan@dankohn.com> >> <http://www.dankohn.com/> <tel:+1-415-233-1000> > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Henning Kilset
2006-Jul-24 11:58 UTC
[Rails] Re: Re: help with "rake db:migrate" error please?
Greg Hauptmann wrote:> Actually I''ve just found some info in the Rails API guide (see below). > I''m guessing what is required is the ":socket" option entry to be setup > as follows: > > socket: /var/run/mysqld/mysqld.sock > >That would be the default socket, which I''m guessing dreamhost isn''t using. the best option here is probably to go TCP - the socket means you''re using a "pipe" connection to mysql, i.e. not invoking the TCP stack. Just comment out or delete the socket line completely, and setup mysql host: localhost, port: 3306. Regards, Henning Kilset
Greg Hauptmann
2006-Jul-24 12:55 UTC
[Rails] Re: Re: Re: help with "rake db:migrate" error please?
I think dreamhost have their mysql database on a different server, hence their request to put the mysql.youdomain.name in. I''m still stuck on this for the moment - no response from Dreamhost yet. Henning Kilset wrote:> Greg Hauptmann wrote: >> Actually I''ve just found some info in the Rails API guide (see below). >> I''m guessing what is required is the ":socket" option entry to be setup >> as follows: >> >> socket: /var/run/mysqld/mysqld.sock >> >> > That would be the default socket, which I''m guessing dreamhost isn''t > using. the best option here is probably to go TCP - the socket means > you''re using a "pipe" connection to mysql, i.e. not invoking the TCP > stack. > > Just comment out or delete the socket line completely, and setup mysql > host: localhost, port: 3306. > > Regards, > Henning Kilset-- Posted via http://www.ruby-forum.com/.
Greg Hauptmann
2006-Jul-24 13:20 UTC
[Rails] Re: Re: Re: help with "rake db:migrate" error please?
BTW - Whilst the dreamhost wiki (http://wiki.dreamhost.com/index.php/Ruby_on_Rails) suggests there is no need for a :socket entry in database.yml I am still getting the "Can''t connect to local MySQL server through socket ''/var/run/mysqld/mysqld.sock'' " error when using "rake db:migrate". I did check the mysql socket location on dreamhost but I couldn''t see this directory? Perhaps unix permissions or a real issue? See below: Any ideas anyone? [skybar]$ mysql_config --socket /var/run/mysqld/mysqld.sock [skybar]$ [skybar]$ [skybar]$ cd /var/run/mysqld -bash: cd: /var/run/mysqld: No such file or directory Regards Greg PS If anyone has a working dreamhost Ruby on Rails application I''d love to see an example of your database.yml file. -- Posted via http://www.ruby-forum.com/.
Dan Kohn
2006-Jul-24 17:00 UTC
[Rails] Re: Re: Re: help with "rake db:migrate" error please?
This is a working dreamhost config. Have you configured your MySQL correctly on Dreamhost (picking a unique domain name for it, etc.) Can you connect to it using MYSQLFront on Windows or CocoaMySQL on a Mac? production: adapter: mysql database: your_db username: your_username password: your_password host: yourdb.yourhostname.com port: 3306 - dan -- Dan Kohn <mailto:dan@dankohn.com> <http://www.dankohn.com/> <tel:+1-415-233-1000> On Jul 24, 2006, at 6:19 AM, Greg Hauptmann wrote:> BTW - Whilst the dreamhost wiki > (http://wiki.dreamhost.com/index.php/Ruby_on_Rails) suggests there > is no > need for a :socket entry in database.yml I am still getting the "Can''t > connect to local MySQL server through socket > ''/var/run/mysqld/mysqld.sock'' " error when using "rake db:migrate". > > I did check the mysql socket location on dreamhost but I couldn''t see > this directory? Perhaps unix permissions or a real issue? See below: > Any ideas anyone? > > [skybar]$ mysql_config --socket > /var/run/mysqld/mysqld.sock > [skybar]$ > [skybar]$ > [skybar]$ cd /var/run/mysqld > -bash: cd: /var/run/mysqld: No such file or directory > > > Regards > Greg > > PS If anyone has a working dreamhost Ruby on Rails application I''d > love > to see an example of your database.yml file. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Greg Hauptmann
2006-Jul-24 20:41 UTC
[Rails] Re: Re: Re: Re: help with "rake db:migrate" error please?
Tks Dan - One final question of clarification (hopefully) The "host: yourdb.yourhostname.com" - what would this look like exactly for a dreamhost site, say where the app is hosted under a subdomain like subdomain1.mysite.com? Is it supposed to start with "mysql."? Dan Kohn wrote:> This is a working dreamhost config. Have you configured your MySQL > correctly on Dreamhost (picking a unique domain name for it, etc.) > Can you connect to it using MYSQLFront on Windows or CocoaMySQL on a > Mac? > > > production: > adapter: mysql > database: your_db > username: your_username > password: your_password > host: yourdb.yourhostname.com > port: 3306 > > > - dan > -- > Dan Kohn <mailto:dan@dankohn.com> > <http://www.dankohn.com/> <tel:+1-415-233-1000>-- Posted via http://www.ruby-forum.com/.
Dan Kohn
2006-Jul-24 20:48 UTC
[Rails] Re: Re: Re: Re: help with "rake db:migrate" error please?
Greg, there''s no preconfigured server; you set it up. In panel.dreamhost.com, select Goodies, Manage MySQL, and your server will show with its hostname, database name, etc. You might also consider creating a new database. - dan -- Dan Kohn <mailto:dan@dankohn.com> <http://www.dankohn.com/> <tel:+1-415-233-1000> On Jul 24, 2006, at 1:41 PM, Greg Hauptmann wrote:> Tks Dan - One final question of clarification (hopefully) > > The "host: yourdb.yourhostname.com" - what would this look like > exactly > for a dreamhost site, say where the app is hosted under a subdomain > like > subdomain1.mysite.com? Is it supposed to start with "mysql."? > > > Dan Kohn wrote: >> This is a working dreamhost config. Have you configured your MySQL >> correctly on Dreamhost (picking a unique domain name for it, etc.) >> Can you connect to it using MYSQLFront on Windows or CocoaMySQL on a >> Mac? >> >> >> production: >> adapter: mysql >> database: your_db >> username: your_username >> password: your_password >> host: yourdb.yourhostname.com >> port: 3306 >> >> >> - dan >> -- >> Dan Kohn <mailto:dan@dankohn.com> >> <http://www.dankohn.com/> <tel:+1-415-233-1000> > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Greg Hauptmann
2006-Jul-24 22:01 UTC
[Rails] Re: Re: Re: Re: Re: help with "rake db:migrate" error please
Hi Dan, Yes. I''ve set up the database on dreamhost OK, I''m able to connect to it via "mysql -u dbuser -p -h mysql.gregnet.org databasename". Also I''m able to run the app successfully via the "ruby script/server" startup & then connect to it via port 3000. I''ll retry again when I''m home using your syntax for the database.yml, however would you be able to give me an example of your "host" line in your database.yml? Do you actually use the "mysql" at the start like "mysql.gregnet.org"? BTW - Did my previous post re the fact I couldn''t see the winsock file on dreamhost make sense to you? ie. [skybar]$ mysql_config --socket /var/run/mysqld/mysqld.sock [skybar]$ [skybar]$ [skybar]$ cd /var/run/mysqld -bash: cd: /var/run/mysqld: No such file or directory Thanks again Dan Greg -- Posted via http://www.ruby-forum.com/.
Dan Kohn
2006-Jul-25 00:15 UTC
[Rails] Re: Re: Re: Re: Re: help with "rake db:migrate" error please
As I understand it, there are two ways to talk to MySQL. Via TCP or via socket. Since it''s on another machine, I believe TCP is your only option. My host line looks like: host: exampledb.example.com But that''s just because I chose to call it exampledb. If you''re able to run script/server (I would generally use script/console to test my database connections), I don''t quite understand the problem. Why are you trying to use mysql_config? Also, note that for both scripts you need to specify production to get them to connect to the right database. - dan -- Dan Kohn <mailto:dan@dankohn.com> <http://www.dankohn.com/> <tel:+1-415-233-1000> On Jul 24, 2006, at 3:00 PM, Greg Hauptmann wrote:> Hi Dan, > > Yes. I''ve set up the database on dreamhost OK, I''m able to connect to > it via "mysql -u dbuser -p -h mysql.gregnet.org databasename". > Also I''m > able to run the app successfully via the "ruby script/server" > startup & > then connect to it via port 3000. > > I''ll retry again when I''m home using your syntax for the database.yml, > however would you be able to give me an example of your "host" line in > your database.yml? Do you actually use the "mysql" at the start > like "mysql.gregnet.org"? > > BTW - Did my previous post re the fact I couldn''t see the winsock file > on dreamhost make sense to you? > > ie. > [skybar]$ mysql_config --socket > /var/run/mysqld/mysqld.sock > [skybar]$ > [skybar]$ > [skybar]$ cd /var/run/mysqld > -bash: cd: /var/run/mysqld: No such file or directory > > > Thanks again Dan > Greg > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Greg Hauptmann
2006-Jul-25 01:59 UTC
[Rails] Re: Re: Re: Re: Re: Re: help with "rake db:migrate" error pl
Hi Dan, I''ll try this syntax when I get home, thanks. I''ll also try the script/console tip too. Re "Why are you trying to use mysql_config" - I just used this as I found advice that suggested "mysql_config --socket" was the way to find out for your ISP where the mysql.sock file is located. BTW - Just to reconfirm the "can''t connect to local MySQL server through socket" error is hitting me as I''m trying to run "rake db:migrate" to get the tables created in the production database. So I guess I''m assuming that running this rake command is the acceptable method of configuring one''s production database. Thanks again Greg -- Posted via http://www.ruby-forum.com/.
Greg Hauptmann
2006-Jul-25 10:22 UTC
[Rails] Re: Re: Re: Re: Re: Re: help with "rake db:migrate" error pl
Doh! Hey Dan - guess what. The problem was simply that I was using: rake db:migrate and not rake db:migrate RAILS_ENV="production" I''d assumed without question that the rake command would be aware of the PRODUCTION setting I had put in place, but I guess it obviously isn''t aware of this setting :( I wonder how I could have picked this up earlier. Anyway, thats for the help, I''ve learnt lots on the way :) Greg -- Posted via http://www.ruby-forum.com/.
Seemingly Similar Threads
- Troubleshooting tips for getting Apache/RailsApp/Dreamhost
- Is capistrano command meant to be run on remote server??
- How do I change MYSQL startup options on Mac??? (can't work it out)
- Capistrano Deployment on Dreamhost
- Cheapest Rails Hosting where they give you full access to Apache (to load modules etc)???