標籤:
錯誤問題的描述:
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
mysql登入時,ERROR 1045 (28000): 錯誤解決辦法