I just began a new Rails project. I''ve done this a couple of times, but I am now working on a new environment: OS: OS X 10.4 MySql: 4.1.12 Rails: 0.12.1 Ruby: 1.8.2 I created my project and my database. I then changed the database.yml file to; adapter: mysql database: mtkf host: localhost username: root password: xxxxxxxx Then I rebooted the webrick server. Then I ran the scaffolding generation script, which gave me this message: Access denied for user ''''@''localhost'' (using password: NO) Huh. Haven''t had that before. So I tried some other database configurations. Using a different user didn''t help. Neither did using a new account with a blank password. I can, of course, connect to the database just fine from the command line or via a front-end client (CocoaMySql 0.6.3). The thing that''s frustrating is that this is such a basic step & one that I''ve done before. Any ideas?
Is it set in the right mode (i.e. production, test, development), WEBrick runs in development mode by default, so make sure you entered the correct details for the correct mode. On 25 May 2005, at 19:29, Ian Whitney wrote:> I just began a new Rails project. I''ve done this a couple of times, > but I am now working on a new environment: > > OS: OS X 10.4 > MySql: 4.1.12 > Rails: 0.12.1 > Ruby: 1.8.2 > > I created my project and my database. I then changed the > database.yml file to; > > adapter: mysql > database: mtkf > host: localhost > username: root > password: xxxxxxxx > > Then I rebooted the webrick server. > > Then I ran the scaffolding generation script, which gave me this > message: > > Access denied for user ''''@''localhost'' (using password: NO) > > Huh. Haven''t had that before. So I tried some other database > configurations. Using a different user didn''t help. Neither did > using a new account with a blank password. > > I can, of course, connect to the database just fine from the > command line or via a front-end client (CocoaMySql 0.6.3). > > The thing that''s frustrating is that this is such a basic step & > one that I''ve done before. > > Any ideas? > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I believe yaml doesn''t like tab characters. Make sure you don''t have any in the file. Ian Whitney wrote:> I just began a new Rails project. I''ve done this a couple of times, but > I am now working on a new environment: > > OS: OS X 10.4 > MySql: 4.1.12 > Rails: 0.12.1 > Ruby: 1.8.2 > > I created my project and my database. I then changed the database.yml > file to; > > adapter: mysql > database: mtkf > host: localhost > username: root > password: xxxxxxxx > > Then I rebooted the webrick server. > > Then I ran the scaffolding generation script, which gave me this message: > > Access denied for user ''''@''localhost'' (using password: NO) > > Huh. Haven''t had that before. So I tried some other database > configurations. Using a different user didn''t help. Neither did using a > new account with a blank password. > > I can, of course, connect to the database just fine from the command > line or via a front-end client (CocoaMySql 0.6.3). > > The thing that''s frustrating is that this is such a basic step & one > that I''ve done before. > > Any ideas? > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
It also doesn''t like certain passwords, from what I can tell- I''ve had this happen, and everything worked out fine when I used a password with no *''s. On 5/25/05, Kevin Williams <kevin-P4szbAuRZ8UqDJ6do+/SaQ@public.gmane.org> wrote:> I believe yaml doesn''t like tab characters. Make sure you don''t have any > in the file. > > Ian Whitney wrote: > > I just began a new Rails project. I''ve done this a couple of times, but > > I am now working on a new environment: > > > > OS: OS X 10.4 > > MySql: 4.1.12 > > Rails: 0.12.1 > > Ruby: 1.8.2 > > > > I created my project and my database. I then changed the database.yml > > file to; > > > > adapter: mysql > > database: mtkf > > host: localhost > > username: root > > password: xxxxxxxx > > > > Then I rebooted the webrick server. > > > > Then I ran the scaffolding generation script, which gave me this message: > > > > Access denied for user ''''@''localhost'' (using password: NO) > > > > Huh. Haven''t had that before. So I tried some other database > > configurations. Using a different user didn''t help. Neither did using a > > new account with a blank password. > > > > I can, of course, connect to the database just fine from the command > > line or via a front-end client (CocoaMySql 0.6.3). > > > > The thing that''s frustrating is that this is such a basic step & one > > that I''ve done before. > > > > Any ideas? > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
> > ------------------------------ > > Is it set in the right mode (i.e. production, test, development), > WEBrick runs in development mode by default, so make sure you entered > the correct details for the correct mode.Thanks for the idea, but I used the same connection setup for all three environments. Ian _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
> > ---------------------------------------------------------------------- > > Message: 1 > Date: Wed, 25 May 2005 15:02:44 -0400 > From: "J.D. Hollis" <cowboysolitude-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > Subject: Re: [Rails] database.yml weirdess > To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Message-ID: <be76bd6d050525120218c5ef74-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> > Content-Type: text/plain; charset=ISO-8859-1 > > It also doesn''t like certain passwords, from what I can tell- I''ve had > this happen, and everything worked out fine when I used a password > with no *''s.Good to know. But my password is just alphabet characters. _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 25/05/05, Ian Whitney <iwhitney-lJS9ZXtlhXvYtjvyW6yDsg@public.gmane.org> wrote:> The thing that''s frustrating is that this is such a basic step & one > that I''ve done before. >Make sure there is a new line at the end of database.yml _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
> > >> The thing that''s frustrating is that this is such a basic step & one >> that I''ve done before. >> >> > > Make sure there is a new line at the end of database.ymlNo luck. But thanks. what seems exceptionally odd is that the error message, Access denied for user ''''@''localhost'', shows that it tried to log in with a blank user name. Why wouldn''t it pull the username out of the database.yml file? _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I had a similar problem with a config.yml file. Everything seemed exactly right, but it would not pull the variables out right. I ended up manually retyping the file from scratch, saving it to a different file name, and then changing my environment.rb reference to that file name. When I did that, it worked. I then changed the file names back to the original. I figure I had some character somewhere that the yaml didn''t like. So you may try retyping (no copying) your database.yml and saving it to a new file ("testdatabase.yml") and then changing : ActiveRecord::Base.configurations File.open("#{RAILS_ROOT}/config/database.yml") { |f| YAML::load(f) } to : ActiveRecord::Base.configurations File.open("#{RAILS_ROOT}/config/testdatabase.yml") { |f| YAML::load(f) } Maybe that will work. Steve On 5/26/05, Ian Whitney <iwhitney-lJS9ZXtlhXvYtjvyW6yDsg@public.gmane.org> wrote:> > > > > The thing that''s frustrating is that this is such a basic step & one > that I''ve done before. > > > > Make sure there is a new line at the end of database.yml > No luck. But thanks. > > what seems exceptionally odd is that the error message, Access denied for > user ''''@''localhost'', shows that it tried to log in with a blank user name. > Why wouldn''t it pull the username out of the database.yml file? > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
On 5/25/05, Ian Whitney <iwhitney-lJS9ZXtlhXvYtjvyW6yDsg@public.gmane.org> wrote:> Then I ran the scaffolding generation script, which gave me this > message: > > Access denied for user ''''@''localhost'' (using password: NO) >Hi, just a stab in the dark, this wouldn''t have anything to do with the mysql old vs. new password issue[1]? [1] http://dev.mysql.com/doc/mysql/en/old-client.html James
>> Then I ran the scaffolding generation script, which gave me this >> message: >> >> Access denied for user ''''@''localhost'' (using password: NO) >You can get this if you haven''t given your computer permissions on the database using the MySQL GRANT command. This happened to me when I was running my rails app on one remote server and trying to access a database on my local machine.
If you''re really wondering if it''s the *.yml file, just run something like: ruby -rYAML -e ''p YAML::load(File.open("database.yml"))'' to see if it''s even parseable. On 5/26/05, Colin Ramsay <webmaster-BFpX1XrDWuBdtzWjJqcUOrVCufUGDwFn@public.gmane.org> wrote:> >> Then I ran the scaffolding generation script, which gave me this > >> message: > >> > >> Access denied for user ''''@''localhost'' (using password: NO) > > > > You can get this if you haven''t given your computer permissions on > the database using the MySQL GRANT command. This happened to me when > I was running my rails app on one remote server and trying to access > a database on my local machine. > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
> > Message: 1 > Date: Thu, 26 May 2005 12:44:55 -0400 > From: Michael Campbell <michael.campbell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > Subject: Re: [Rails] database.yml weirdess > To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Message-ID: <811f2f1c0505260944445ed1b0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> > Content-Type: text/plain; charset=ISO-8859-1 > > If you''re really wondering if it''s the *.yml file, just run > something like: > > ruby -rYAML -e ''p YAML::load(File.open("database.yml"))'' > > to see if it''s even parseable.This was a good suggestion. Thanks. It returned a hash that contained my correct username and password, so the file is being parsed correctly. Following the advice of another message on here, I converted my MySql password to their old scheme. Sadly, I''m still getting the same error, Access denied for user ''''@''localhost'' (using password: NO) _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Not sure if it''s your problem, but this thread may be of some help: http://forum.textdrive.com/viewtopic.php?pid=33609 Ben On 5/27/05, Ian Whitney <iwhitney-lJS9ZXtlhXvYtjvyW6yDsg@public.gmane.org> wrote:> > > Message: 1 > Date: Thu, 26 May 2005 12:44:55 -0400 > From: Michael Campbell <michael.campbell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > Subject: Re: [Rails] database.yml weirdess > To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Message-ID: <811f2f1c0505260944445ed1b0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> > Content-Type: text/plain; charset=ISO-8859-1 > > If you''re really wondering if it''s the *.yml file, just run something like: > > ruby -rYAML -e ''p YAML::load(File.open("database.yml"))'' > > to see if it''s even parseable. > This was a good suggestion. Thanks. It returned a hash that contained my > correct username and password, so the file is being parsed correctly. > > Following the advice of another message on here, I converted my MySql > password to their old scheme. > > Sadly, I''m still getting the same error, Access denied for user > ''''@''localhost'' (using password: NO) > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >