geokara1322 geokara1322 - 4 months ago 61
SQL Question

Ruby on rails - Mysql2::Error Access denied for user 'simple_cms'@'localhost' (using password: YES)

I am working through a RoR tutorial from lynda.com
for a week already & without changing anything today i was not able to see my content on localhost due to this error :

Mysql2::Error Access denied for user 'simple_cms'@'localhost' (using password: YES)


I do know that this problem has been referred many times befored , i am still not able to find a confirmed solution .

To give you further information regarding my set up my working enviroment is
Yosemite 10.10.4
-
Rails 3.2.22
-
5.6.22 MySQL
-
WEBrick 1.3.1


i have set up the SQL database as it looks below on the
database.yml
file on the config folder of the project

development:
adapter: mysql2
encoding: utf8
reconnect: false
database: simple_cms_development
pool: 5
username: simple_cms
password: **********
socket: /tmp/mysql.sock


test:
adapter: mysql2
encoding: utf8
reconnect: false
database: simple_cms_test
pool: 5
username: root
password:
socket: /tmp/mysql.sock

production:
adapter: mysql2
encoding: utf8
reconnect: false
database: simple_cms_production
pool: 5
username: root
password:
socket: /tmp/mysql.sock


Also i noticed that by trying to connect via terminal on the database with the password


ยง mysql -u root -p



and again i get the error ::
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
.

I tried to restart manually MySQL server from menu & all i got was the same error!

What is the problem and it doesn't let me log in with the settings as i did all this time ?

Is it a problem with rails or with mysql settings?

While everything seems to be as it has to be,do i have to change something on the
database.yml
file?

Answer

I finally solved this problem by uninstalling the current MySQL via terminal with the command brew uninstall MySQL & then reinstalling it with brew, from the beginning!

After the installation, when i tried to login into MySQL i did it through the command :mysql -u root -p! At this point on the password request i added the one that has been set up before on the config file :database.yml and it logged in succesfully!

Thanks for the help!

Comments