0

I create a database in mysql i'm using mysql2 gem and Rails 2 i've already saw some question here about this, but non of them works for me.

I have my database.yml file like so:

development:
  adapter: mysql2
  database: db
  username: root
  password: 'root'
  host: localhost

i can login into mysql in the command line like this:

mysql -u root -p

and enter the same password: root and i have no error, but when i try to see a page after running scrpit/server the application always show the error Access denied for user 'root'@'localhost' (using password: NO)

Any idea what could be happening here please? Thanks

  • can you remove single quotes from root like 'root' to root – Thorin May 25 '16 at 18:54
  • Does this help? http://stackoverflow.com/a/6081358/155826 – Ryenski May 25 '16 at 18:55
  • Haver you tried connecting via the socket method? `socket:` is also a valid parameter and should be the path to where your MySQL socket is. – tadman May 25 '16 at 19:20
  • @Thorin yes i try that, doesn't work. @mysmallidea in my case i says `using password: NO` but when i enter a incorrect password i yes `using password: YES` i try folling the guied but i face a error in one of the commands @tadman yes i try that, i says the same – user2270553 May 25 '16 at 19:54

1 Answers1

0

replace for this:

  development:
    adapter: mysql2
    database: gradesfirst
    username: root
    password: ''
    host: localhost

or assign a password for the root user on mysql.

  • thanks for the reply I already tried that, it doesn't work, also as i mention in the question the password is there which is root, i can login to mysql via terminal using the password root, but in rails i still have the same error: `Access denied for user 'root'@'localhost' (using password: NO)` – user2270553 May 25 '16 at 19:15
  • try to create a new user for mysql, grant permissions and set a password, then use that user to log in rails. – Elias Sanchez Jun 01 '16 at 00:02