LOADING

加载过慢请使用代理,全球站仅提供非中国大陆地区CDN支持

修复MySQL5.5中ERROR 1045

在Windows MySQL5.5上遇到如下问题:

C:\Users\Administrator>mysql -uroot -p
Enter password: ****
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

C:\Users\Administrator>mysql -v
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)

C:\Users\Administrator>mysql -v
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)

尝试操作:
找到MySQL安装路径,默认为“C:\Program Files\MySQL\MySQL Server 5.5”,以记事本方式(可选择其他编辑器打开)打开文件"my.ini",在"[mysqld]"项中添加内容:

skip-grant-tables

Ctrl+S保存文件

打开Windows服务管理,打开方式:按Win+R在窗口输入services.msc。找到服务程序mysql,右键选择"重新启动"

重新打开CMD或PowerShell窗口

键入:

mysql -v

窗口输出:

C:\Users\Administrator>mysql -v
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.40 MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>