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 :
我正在通过lynda.com的RoR教程工作一周,而且今天没有改变任何东西我因为这个错误而无法在localhost上看到我的内容:
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
为了向您提供有关我的设置的更多信息,我的工作环境是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
我已经在项目的config文件夹上的database.yml文件中设置了SQL数据库
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
§mysql-u root -p
and again i get the error ::ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
.
我再次收到错误:: ERROR 1045(28000):拒绝访问用户'root'@'localhost'(使用密码:YES)。
I tried to restart manually MySQL server from menu & all i got was the same error!
我尝试从菜单中手动重启MySQL服务器,我得到的是同样的错误!
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?
是rails还是mysql设置有问题?
While everything seems to be as it has to be,do i have to change something on the database.yml
file?
虽然一切似乎都必须如此,但我是否必须在database.yml文件上进行更改?
3 个解决方案
#1
0
The error-message
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES).
will Show up if you entered a wrong password. Reset your Password according to this link.
将在您输入错误密码时显示。根据此链接重置您的密码。
#2
0
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!
我终于通过使用命令brew uninstall MySQL卸载当前MySQL来解决这个问题,然后从一开始就用brew重新安装它!
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!
安装后,当我尝试登录MySQL时,我通过命令执行了:mysql -u root -p!此时在密码请求中我添加了之前在配置文件中设置的那个:database.yml并且它已成功登录!
Thanks for the help!
谢谢您的帮助!
#3
0
You need to do 3 things :
你需要做3件事:
- Check if Mysql Server is On(or Started)
- Change the password logging in mysql from terminal.
-
Create a database in your project folder using:
使用以下命令在项目文件夹中创建数据库
$ rake db:create
$ rake db:create
检查Mysql Server是否已打开(或已启动)
从终端更改mysql中的密码登录。
and that should do it for you so it did for me.
这应该为你做,所以它为我做了。
#1
0
The error-message
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES).
will Show up if you entered a wrong password. Reset your Password according to this link.
将在您输入错误密码时显示。根据此链接重置您的密码。
#2
0
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!
我终于通过使用命令brew uninstall MySQL卸载当前MySQL来解决这个问题,然后从一开始就用brew重新安装它!
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!
安装后,当我尝试登录MySQL时,我通过命令执行了:mysql -u root -p!此时在密码请求中我添加了之前在配置文件中设置的那个:database.yml并且它已成功登录!
Thanks for the help!
谢谢您的帮助!
#3
0
You need to do 3 things :
你需要做3件事:
- Check if Mysql Server is On(or Started)
- Change the password logging in mysql from terminal.
-
Create a database in your project folder using:
使用以下命令在项目文件夹中创建数据库
$ rake db:create
$ rake db:create
检查Mysql Server是否已打开(或已启动)
从终端更改mysql中的密码登录。
and that should do it for you so it did for me.
这应该为你做,所以它为我做了。