打赏

mysql登录时,ERROR 1045 (28000): 错误解决办法

    错误问题的描述:

 

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 authtntication_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

 

 

感谢下面的博主:

 http://www.ithao123.cn/content-10746582.html 

 

推荐书籍:

 

 

 

 

 

 

 

 

 

欢迎大家,加入我的微信公众号:大数据躺过的坑        人工智能躺过的坑
 
 
 

同时,大家可以关注我的个人博客

   http://www.cnblogs.com/zlslch/   和     http://www.cnblogs.com/lchzls/      http://www.cnblogs.com/sunnyDream/   

   详情请见:http://www.cnblogs.com/zlslch/p/7473861.html

 

  人生苦短,我愿分享。本公众号将秉持活到老学到老学习无休止的交流分享开源精神,汇聚于互联网和个人学习工作的精华干货知识,一切来于互联网,反馈回互联网。
  目前研究领域:大数据、机器学习、深度学习、人工智能、数据挖掘、数据分析。 语言涉及:Java、Scala、Python、Shell、Linux等 。同时还涉及平常所使用的手机、电脑和互联网上的使用技巧、问题和实用软件。 只要你一直关注和呆在群里,每天必须有收获

 

      对应本平台的讨论和答疑QQ群:大数据和人工智能躺过的坑(总群)(161156071) 

 

 

 

 

 

 

 

 

 

 

 

 

 

posted @ 2016-10-08 10:59  大数据和AI躺过的坑  阅读(85815)  评论(3编辑  收藏  举报