1045 access denied for user 'root'@'localhost' using password yes

这两个在安装mysql数据库碰到一些头疼的很。

 

   "1045 access denied for user 'root'@'localhost' using password yes"

在命令行中进入:C:\Program Files\MySQL\MySQL Server 5.5\bin

 

 

C:\Program Files\MySQL\MySQL Server 5.1\bin>mysqld  --defaults-file="C:\Program Files\MySQL\MySQL Server 5.5\bin\my.ini" --console --skip-grant-tables

090515 22:06:09 [ERROR] The update log is no longer supported by MySQL in versio
n 5.0 and above. It is replaced by the binary log. Now starting MySQL with --log
-bin='' instead.
090515 22:06:09  InnoDB: Started; log sequence number 0 324221
090515 22:06:09 [Note] mysqld: ready for connections.
Version: '5.1.33-community-log'  socket: ''  port: 3306  MySQL Community Server
(GPL)

看到这个结果就说明MySQL已经起来了。
再开一个DOS窗口,同样切到mysql bin目录下,

输入

mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’; 
mysql> FLUSH PRIVILEGES; 
mysql> quit 

然后
C:\Program Files\MySQL\MySQL Server 5.5\bin>mysqladmin shutdown
之后正常重启MySQL服务就行了。

 

 

配置好最后点击 Execute 按钮了,但是进行不到 Start service 这一步。

检查了下 MySQL 系统服务已添加,但是无法启动,手工也不行。这时候用事件查看器可以看到程序事件里有几个来自于 MySQL 的错误: 

Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 
Unknown/unsupported table type: INNODB 

原来是因为这两版本的 MySQL 默认使用了支持事物的 INNODB 引擎,打开 my.ini 文件,在 MySQL 的安装文件夹, 如 C:\Program Files\MySQL\MySQL Server 5.5\bin 中,看到: 

default-storage-engine=INNODB 

解决办法是把该设置改为 

default-storage-engine=MYISAM 

 

如果还是不行则找到:skip-innodb 取消注销,后在服务中手动启动。

 

 

注:主要参考http://bbs.csdn.net/topics/310006640

 

posted @ 2014-07-25 19:50  whroid  阅读(294)  评论(0编辑  收藏  举报