大家好,又见面了,我是你们的朋友全栈君。
本文转载自:http://www.cnblogs.com/zlslch/p/5937784.html
错误问题的描述:
ERROR 1045 (28000): Access denied for user ‘ODBC’@’localhost’ (using password: NO)
ERROR 1045 (28000): Access denied for user ‘ODBC’@’localhost’ (using password: YES)
windows下,以上两个错误的解决方法
解决方法:
1、找到配置文件my.ini ,然后将其打开,可以选择用NotePadd++打开
2、打开后,搜索mysqld关键字
找到后,在mysqld下面添加skip-grant-tables,保存退出。
PS:若提示不让保存时,可以将该文件剪切到桌面,更改保存后再复制到mySQL目录下
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It’s a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
skip-grant-tables
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir = D:\SoftWare\MySQL\mysql-5.7.11-winx64
datadir = D:\SoftWare\MySQL\mysql-5.7.11-winx64\Data
port = 3306
# server_id = …..
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
这样,是用于跳过密码问题,但是呢,这并不能彻底解决!
3、重启mysql服务
在任何路径目录下,都可以关闭/重启mysql的服务呢。(因为,之前,已经配置全局的环境变量了)
net stop mysql
net start mysql
4、进入数据库,重设置密码。
mysql -u root -p Enter
不用管password Enter
mysql> use mysql; Enter
mysql> update mysql.user set authentication_string=password(‘rootroot’) where user=’root’; (密码自己设)
mysql> flush privileges; 刷新数据库
mysql> quit;
5、密码重设置成功,改好之后,再修改一下my.ini这个文件,把我们刚才加入的”skip-grant-tables”这行删除,保存退出再重启mysql服务就可以了。
6、重启mysql服务,并登录mysql用户,用户是root,密码是rootroot。
D:\SoftWare\MySQL\mysql-5.7.11-winx64\bin> net stop mysql
D:\SoftWare\MySQL\mysql-5.7.11-winx64\bin> net start mysql
D:\SoftWare\MySQL\mysql-5.7.11-winx64\bin>mysql -u root -p
Enter password:rootroot
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/135762.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...