mysql 數據庫忘記了密碼處理

在安裝完了忘記了登錄數據庫的密碼,能夠作如下的處理:mysql

一、修改root密碼sql

sudo more /etc/mysql/debian.cnf數據庫

用文件裏的用戶名密碼登錄Mysqlide

use mysql.net

update user set plugin='mysql_native_password' where user='root';get

update user set authentication_string=password('123') where user='root';string

flush privillege;it

二、配置遠程訪問數據庫io

註釋掉在/etc/MySQL/mysql.conf.d/mysqld.cnf裏面的bind-address = 127.0.0.1配置

鏈接mysql數據庫,修改user表

Grantall on *.* to 'root'@'%' identifiedby 'root用戶的密碼' withgrant option;flush privileges;

相關文章
相關標籤/搜索