Error: 'Access denied for user 'root'@'localhost' <using password: NO>'

rails railscoders --database=mysql

created the directory with folders except for a ‘components/’ folder
which Practical Rails by Alan B. lists as one of the folders
created.

Continuing with:
mysqladmin -u root create railscoders_development

returns this:

mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@‘localhost’ ’

My database.yml file shows

development:
adapter: mysql
encoding: utf8
database: railscoders_development
username: root
password:
host: localhost

along with same for test and production.

And as I’m on windows these comments at the top of the yml file it
that helps explain the error:

On Windows:

gem install mysql

Choose the win32 build.

Install MySQL and put its /bin directory on your path.

And be sure to use new-style password hashing:

http://dev.mysql.com/doc/refman/5.0/en/old-client.html

Any sugggestions?

Bruce

On 3 April 2011 03:14, wordmystic [email protected] wrote:

mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@‘localhost’ ’

That is not a Rails issue, it is saying that you have not setup your
mysql server to allow access as user root with no password. Assuming
that you have setup a mysql server then provide a valid user and
password in the mysqladmin command. Google for mysqladmin if you do
not know how to do that.

My database.yml file shows

development:
adapter: mysql
encoding: utf8
database: railscoders_development
username: root
password:

Also setup appropriate user and password here.

Colin

Hello Bruce, i think Dan is correct.
Rails usually look out for database in some cases even if it doesnt
have to.
But if you havent set a password in MySQL while installing in the
first case then you dont need to fill the password blank.
Also, which MySQL are you using ?

Now, if u have set a password then in that case you will have to login
as
“mysql -u root -p”
It will ask u the password after you enter this command.
Once you put the password it will not pop any such error.