在Windows MySQL5.5上遇到如下问题:
shell
C:\Users\Administrator>mysql -uroot -pEnter password: ****ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)C:\Users\Administrator>mysql -vERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)C:\Users\Administrator>mysql -vERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)尝试操作:
找到MySQL安装路径,默认为“C:\Program Files\MySQL\MySQL Server 5.5”,以记事本方式(可选择其他编辑器打开)打开文件"my.ini",在"[mysqld]"项中添加内容:
config
skip-grant-tables按Ctrl+S保存文件
打开Windows服务管理,打开方式:按Win+R在窗口输入services.msc。找到服务程序mysql,右键选择"重新启动"
重新打开CMD或PowerShell窗口
键入:
shell
mysql -v窗口输出:
shell
C:\Users\Administrator>mysql -vWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3Server 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 itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>