Mysql2 :: Error (access denied for user "root" @ "localhost" (using password: no)):

Just configure the new rails 3.1.3 application using mysql (mysql2 gem) on CentOS 5 server / apache / passenger ... I have correctly configured the database and user for this database, and I added the login and information to my database.yml file ... I can generate material, and rake db: migrate ok, but "We're sorry, but something went wrong." the message is displayed in the browser and this message appears in my production.log file!

GET "/" will begin for xx.xxx.xx.xxx on 2011-12-29 19:52:35 -0600

Mysql2 :: Error (access denied for user "root" @ "localhost" (using password: no)):

strange, I do not use "root" as the login information for database.yml ... Any suggestions?

development:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: the_db_I_made
  pool: 5
  username: the_user_I_made
  password: the_password
  socket: /var/lib/mysql/mysql.sock

production:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: the_db_I_made
  pool: 5
  username: the_user_I_made
  password: the_password
  socket: /var/lib/mysql/mysql.sock
+5
source
5

, , :)

: , , 3.0.9, gem 3.0.11. , 3.0.11, 3.0.9 rails_server.conf. , http://blog.phusion.nl/

+1

/:

  • ?

    mysql -u root -p
    
  • ? , , .

  • socket: /var/lib/mysql/mysql.sock
    
  • ​​ gem?

    gem check mysql2
    

EDIT:

(, , , , , , )

** !! **

"" !

:

production:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  host: your_host #<----- normally localhost
  database: the_db_I_made
  pool: 5
  username: the_user_I_made
  password: the_password
  socket: /var/lib/mysql/mysql.sock
+4
  • Ubuntu 1)/usr/bin/mysql_secure_installation 2) , mysql here.Everything done.then database.yml , . ..
0

"the_db_I_made" ?

, , .

Now try to configure it.

0
source

For Me It threw an error due to the lack of a database. So, I created one. Using:

$ rake db: create

And the problem was solved: D

0
source

All Articles