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) 

 

 

 

 

 

 

 

 

 

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM