1. 程式人生 > >mysql5.6忘記資料庫的root密碼,重置密碼

mysql5.6忘記資料庫的root密碼,重置密碼

mysql5.6忘記資料庫的root密碼:

[[email protected] ~]# mysql -uroot -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

檢視當前安裝的mysql版本:
[email protected] ~]# rpm -qa | grep MySQL
MySQL-server-5.6.15-1.el6.x86_64
MySQL-client-5.6.15-1.el6.x86_64
MySQL-shared-compat-5.6.15-1.el6.x86_64

MySQL-devel-5.6.15-1.el6.x86_64
perl-DBD-MySQL-4.022-1.el6.rfx.x86_64


停止mysql服務:
[[email protected] ~]# service mysql stop
Shutting down MySQL.. SUCCESS! 

進入到skip-grant-tables模式:

[[email protected] ~]# mysqld_safe --skip-grant-tables
140211 15:37:49 mysqld_safe Logging to '/var/lib/mysql/oraserver139.err'.

140211 15:37:49 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql


現在就不需要密碼就可以進入mysql了:

[[email protected] ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.15 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

進入mysql系統資料庫:
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed

修改root賬戶密碼:
mysql> update user set password=password("12345") where user="root";
Query OK, 4 rows affected (0.02 sec)
Rows matched: 4 Changed: 4 Warnings: 0


重新整理許可權:
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye


停止mysql程序:

[1]+ Stopped mysqld_safe --skip-grant-tables

啟動mysql:

[[email protected] ~]# service mysql start
Starting MySQL SUCCESS! 


使用剛才修改的密碼進入mysql:

[[email protected] ~]# mysql -uroot -p12345
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.15

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement

mysql> SET PASSWORD = PASSWORD('12345');
Query OK, 0 rows affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)

修改完成;

相關推薦

mysql5.6忘記資料庫root密碼,密碼

mysql5.6忘記資料庫的root密碼:[[email protected] ~]# mysql -uroot -pEnter password: ERROR 1045 (28000): Access denied for user 'root'@'local

Centos6.5 6.6 (均可) 密碼或強行破解root密碼 簡單操作

丟失 方向 朋友 重啟 ges 無需 shadow order article centos忘記root密碼怎麽重置root密碼? 使用Linux系統的時候root密碼是十分關鍵的安全機制。 但是假設那天丟失了root密碼的話問題就嚴重了。 百牛信息技術baini

MySQL5.6 以上版本 首次登陸不知道預設密碼 密碼問題

1、修改/etc/my.cnf檔案,在mysqld配置項下面增加skip-grant-tables,如下圖 2、重啟mysql服務       #service mysqld restart 3、無密碼登陸mysql #mysql  #update user

Mysql 8.0.13忘記密碼 密碼

前言 網上很多關於mysql密碼重置的方法,例如: cmd 裡敲命令: mysqld –skip-grant-tables 以不輸入密碼的方式啟動MySQL服務,但是這條命令對MYSQL8.0.13,是沒有任何作用的。 經過多次實驗,親測可用方法如下(很簡單)。 方法 1.開啟命

zabbix忘記admin登錄密碼密碼

數據庫 權限表 min http 用戶名 sel nss 賬號 table 問題描述: 有時候忘記admin的密碼了,因為賬號太多 解決方案: 1、zabbix連接的是mysql數據庫 [root@localhost /]# mysql -uroot -pA

windows下mysql5.7忘記密碼情況下密碼問題暨Access denied for user 'root'@'localhost'問題解決方案

1、停止mysql服務,修改my.ini,設定無密碼登入(注:mysql5.7的data目錄及my.ini預設在此目錄:C:\ProgramData\MySQL\MySQL Server 5.7。)修改內容:在[mysqld]下增加skip-grant-tables,增加後重

centOS 6.5 mysql5.6忘記密碼密碼

1、停止mysql服務 service mysqld stop [[email protected] ~]# service mysqld stop Stopping mysqld:

linuxcentos忘記root管理用戶密碼 單用戶模式維護密碼操作指引

img root 直接 cto process 無網 圖形 運行 系統 本操作需在linux系統主機操作; 開機;啟動界面按任意建進入選擇系統菜單; 按E鍵;選擇第二個,最長的;在按一次"E"鍵; 輸入 空格 “1”,回車;按B鍵;已經登錄了root用

ubantu 18.02 root密碼忘記密碼方法

開機按Esc,進入GRUB 選擇*Advanced options for Ubuntu 選擇*Ubuntu,with Linux 4.15.0-20-generic(recovery mode) 選擇root drop to root shell promt

mysql root忘記密碼

1.停止mysql服務 2. cd /usr/local/mysql/bin sudo su #切換root 3../mysqld_safe --skip-grant-tables & #啟動mysql並忽略認證 4. mysql -uroot #進入mysql

MySQL 忘記 root 密碼方法

MySQL 版本: 5.6 / 5.7   一、Linux 伺服器版本 1.登入並開啟兩個 Linux 伺服器 ssh 控制檯 a.控制檯1:停止當前 mysqld 服務並以無授權狀態並禁用網路連線的方式啟動MySQL service

[ mysql ] linux mysql 忘記root密碼

[ mysql ] linux  mysql 忘記root密碼重置 作者:flymaster qq:908601287 blog:http://www.cnblogs.com/flymaster500/ mysql相關命令及安全配置 1. 為mysql的root使用者設定密碼[[email

CentOS 基本指令(五)——安裝部署MySQL資料庫 & root使用者密碼

首先使用wget命令下載MySQL rpm 包,使用如下命令進行解壓,安裝MySQL。 wget http://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm rpm -ivh mysql80-com

[MySQL] MySQL5.6忘記root密碼

環境: CentOS6.7 + MySQL5.6,忘記root密碼。 重置方法: 1. 停止MySQL服務 [[email protected] ~]# service mysql stop 2. 修改MySQL配置檔案,取消賬號驗證 [[email pr

windows下mysql5.7 root密碼

1、在mysql根目錄下新建配置檔案my.ini(因為我安裝的mysql-5.7.24安裝完成後未看到該配置檔案,所以新建一個,有的直接修改即可) [mysqld] skip-grant-tables   2、上述配置檔案新增後重啟MySQL,輸入mysql -h localhost

MAC: MySql修改root密碼 mac Mysql忘記密碼 mysql mac密碼

0:關閉mysql sudo /usr/local/mysql-5.7.13-osx10.11-x86_64/support-files/mysql.server stop 1:進入mysql資料夾 cd /usr/local/mysql-

Redhat忘記root密碼情況下密碼及後續啟報錯解決方法

一、首先重啟Linux系統主機,在出現引導介面時,按下鍵盤的e進入核心編輯頁面二、在linux16引數這行的最後面追加 rd.break , 然後按下Ctrl + X三、待系統進入緊急救援系統後輸入以下命令mount -o remount,rw /sysroot chroot

mysql5.5忘記密碼方法

今天我在使用mysql時,想要去修改密碼,就百度了一下,網上教程很多,沒幾個能用的,而我百度的那個教程把我給坑了,即把密碼改了,自己也登陸不成功了! 關於忘記密碼登陸的方法,網上的教程說的也不是很詳細,百度了好久才找到一個有用的! 一、  mysql資料庫許可權問題

mysql5.6 密碼

1. 首先net stop mysql服務,並且切換到工作管理員,有與mysql有關的,最好關閉程序。(我的 mysql 版本是5.6,所以開啟服務是 net start mysql56,關閉服務是 net stop mysql56) 2. 執行CMD命令切換到MySql安

Mac OS X 10.11.4 忘記root密碼步驟

非常尷尬的是,由於平時用的個人使用者; 太久沒用root賬號,導致經常忘記mac 的root密碼 。 如下是非常簡單的重置步驟; 前提:你知道你當前賬號的密碼。 步驟如下(可直接對著操作): (1)以普通使用者名稱登入系統,並開啟terminal終端, 輸入:sudo bash