MYSQL錯誤代碼#1045 Access denied for user 'root'@'localhost'

http://blog.csdn.net/lykezhan/article/details/70880845

遇到MYSQL“錯誤代碼#1045 Access denied for user 'root'@'localhost' (using password:YES)” 需要重置root賬號權限密碼,這個一般還真不好解決。

????不過,這幾天調試的時候真的遇到了這種問題,不能跳過,必須解決才能在 本地調試程序源碼,沒辦法,一點點解決吧。

????好在遇到這種問題的情況,大有人在,所以很多就搬現成的,只要能解決問題就行了。

????方法:

????第一點,停止MYSQL服務,CMD打開DOS窗口,輸入 "net stop mysql ";不過有時候不停止也是無所謂;

????第二點,在CMD命令行窗口,進入MYSQL安裝目錄 比如“E:\APMServ5.2.6\MySQL5.1\bin”(我用的就是APMServer)

????如下圖:

????第三點,在第二點的命令窗口輸入命令為:"mysqld-nt --skip-grant-tables"

????作用是,進入mysql安全模式,即當mysql起來后,不用輸入密碼就能進入數據庫。?

????這時候可以進入數據庫后,給自己的數據庫重新設置密碼就可以了!

????

????如果,還是出現1045錯誤的話,繼續執行以下操作

????1.重新打開一個CMD命令行窗口,輸入:"mysql -uroot -p",使用空密碼的方式登錄MySQL(不用輸入密碼,直接按回車)?

????2.輸入以下命令開始修改root用戶的密碼(注意:命令中"mysql.user"中間有個“點”)?

????"mysql>update mysql.user set password=PASSWORD('新密碼') where User='root'; "

????3.刷新權限表?

????"mysql>flush privileges"?

????4.退出 :"mysql>quit "


????搞定,功成身退!


本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/384174.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/384174.shtml
英文地址,請注明出處:http://en.pswp.cn/news/384174.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

C語言操作符

移位表達式 左移操作符<< 左邊拋棄,右邊補零 右移操作符>> 1.邏輯右移 左邊補零,右邊丟棄 2.算數右移 左邊補符號位,右邊丟棄 注意: 1.左移一位相當于乘2,右移一位相當于除2,并且在內存中存放的是二進制的補碼,且移位操作符只對int型數操作 2.移位操作符不要移動…

棋盤問題——DFS

【題目描述】 在一個給定形狀的棋盤&#xff08;形狀可能是不規則的&#xff09;上面擺放棋子&#xff0c;棋子沒有區別。要求擺放時任意的兩個棋子不能放在棋盤中的同一行或者同一列&#xff0c;請編程求解對于給定形狀和大小的棋盤&#xff0c;擺放k個棋子的所有可行的擺放方…

linux安裝mysql和使用c語言操作數據庫的方法 c語言連接mysql

http://www.jb51.net/article/46139.htm 1. MySQL的安裝與配置&#xff1a; 在Ubuntu下安裝MySQL方法很簡單&#xff0c;使用如下命令&#xff1a; 復制代碼 代碼如下:sudo apt-get install mysql-server安裝的過程中系統會提示設置root密碼&#xff0c;此過程可以跳過&#…

常量變量以及循環

常量 1.三目運算詞 三字母詞表達字符???([??)]??<{??>} 2.循環 1).數組元素以及變量在內存中的分配順序 2)goto語句應用 //電腦關機程序 #include<stdio.h> #include <stdlib.h> #include <string.h> #include <windows.h> int ma…

Dungeon Master——BFS

【題目描述】 You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south, east, west, up or down. You cannot move …

Linux 環境 C語言 操作MySql 的接口范例

http://www.cnblogs.com/wunaozai/p/3876134.html 接上一小節&#xff0c;本來是計劃這一節用來講數據庫的增刪改查&#xff0c;但是在實現的過程中&#xff0c;出現了一點小問題&#xff0c;也不是技術的問題&#xff0c;就是在字符界面上比較不好操作。比如要注冊一個帳號&a…

二進制邏輯運算符有關練習題

//1.寫一個函數返回參數二進制中 1 的個數 #include<stdio.h> int div 0; //除數 int rem 0; //余數 int count 0; //計1 int count_one_bits(unsigned int div) {int con 0; //商while (div > 1){con div / 2;rem div % 2;div con;if (1 rem){count;}}…

Catch That Cow——BFS

【題目描述】 Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 100,000) on the same number line. Farmer Jo…

利用mysql提供的c語言接口操作數據庫

http://blog.csdn.net/bladeandmaster88/article/details/52980872 //1.工程要在c/c->常規->附加包含目錄添加mysql.h的路徑D:\mysql5.5\include //2.工程要在鏈接器->常規->附加庫目錄添加libmysql.lib的路徑D:\mysql5.5\lib #include <WinSock2.h>/…

數組相關運算

數組的初始化 數組及指針在內存中的存儲 一維數組在內存中的存儲 有關數組的運算 //一維數組 int a[] {1,2,3,4}; printf("%d\n",sizeof(a));//16這里的a表示的是整個數組,計算出的是整個數組的大小,單位為byte printf("%d\n",sizeof(a 0));/*a沒有單獨…

Find The Multiple——簡單搜索+大膽嘗試

【題目描述】 Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there is a corresponding m containing no more t…

C語言操作MYSQL小例子

http://blog.csdn.net/small_qch/article/details/8180678 初學使用用C語言操作MYSQL&#xff0c;寫了個小例子&#xff0c;帖上來獻丟人一下&#xff0c;呵呵。 程序很簡單&#xff0c;先連接數據庫&#xff0c;然后向class1表中插入一條數據&#xff0c;最后獲取并輸出整個cl…

Find a way——BFS

【題目描述】 Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good friend Merceki. Yifenfei’s home is at the countryside, but Merceki’s home is in the ce…

用C語言操作MySQL數據庫

http://blog.chinaunix.net/uid-26743670-id-3479887.html 參考MYSQL的幫助文檔整理 這里歸納了C API可使用的函數&#xff0c;并在下一節詳細介紹了它們。請參見25.2.3節&#xff0c;“C API函數描述”。 函數 描述 mysql_affected_rows() 返回上次UPDATE、DELETE或INSERT查…

三字棋

整個游戲可以分為以下幾個環節 1.打印一個玩游戲的菜單 2.玩游戲 (1)玩家走一步 (2)電腦走一步 每走一步對結果進行顯示,其中游戲的結果可分為玩家贏,電腦贏,以及平局 代碼顯示如下 game.c #define _CRT_SECURE_NO_WARNINGS 1 #include<stdlib.h> #include<stdio.h&…

gets fgets 區別

http://www.cnblogs.com/aexin/p/3908003.html 1. gets與fgets gets函數原型&#xff1a;char*gets(char*buffer);//讀取字符到數組&#xff1a;gets(str);str為數組名。 gets函數功能&#xff1a;從鍵盤上輸入字符&#xff0c;直至接受到換行符或EOF時停止&#xff0c;并將讀取…

Fliptile——搜索+二進制優化

【題目描述】 Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which they manipulate an M N grid (1 ≤ M ≤ 15; 1 ≤ N ≤ 15) of square tiles, each of which is col…

掃雷

1.將掃雷界面看成一個二維數組,先對界面進行打印 2.置雷 3.排雷 4.對每次的結果進行游戲輸出 5.提醒用戶游戲輸贏 game.c #define _CRT_SECURE_NO_WARNINGS 1 #include"game.h" //初始化 void init_board(char mine[ROWS][COLS], int rows, int cols, char set) {in…

C相關練習題

1.調整數組使奇數全部都位于偶數前面。 輸入一個整數數組&#xff0c;實現一個函數&#xff0c;來調整該數組中數字的順序使得數組中所有的奇數位于數組的前半部分&#xff0c;所有偶數位于數組的后半部分。 #include<stdio.h> void range(int arr[], int sz) {int left…

【C語言】單鏈表的所有操作的實現(包括PopBack、PushBack、PopFront、PushFront、Insert)

http://blog.csdn.net/hanjing_1995/article/details/51539563 [cpp] view plaincopy #define _CRT_SECURE_NO_WARNINGS 1 #include<iostream> using namespace std; //單鏈表的實現 #include<assert.h> typedef int DataType; typedef…