mysql登入時,ERROR 1045 (28000): 錯誤解決辦法

來源:互聯網
上載者:User

標籤:

    錯誤問題的描述:

 

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): 錯誤解決辦法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.