mysql 7 忘記密碼

2021-07-15 10:26:56 字數 432 閱讀 9314

1、停止mysql 服務

/etc/rc.d/init.d/mysqld stop

2、mysql 配置檔案/etc/my.cnf mysqld 程序配置檔案中新增 skip-grant-tables。啟動mysql 服務

3、此時mysql 是免密碼登入的。

#mysql -uroot -p

連續兩次回車鍵就可以登入mysql

4、修改密碼:

mysql>update mysql.user set authentication_string=password('abc123!@#') where user='root';

重新整理許可權

mysql>flush privileges;

5、退出mysql,刪除 my.cnf 的skip-grant-tables 配置,重啟mysql服務,即可使用密碼登入。

MYSQL 7 資料過濾

小於等於10,並且vend id為1001的資料 select prod id,prod name,prod price from products where prod price 10 and vend id 1001 產品 大於等於10,並且產品編號為1002或者為1003。返回的結果按 從高...

mySQL 7 儲存過程

建立與呼叫。1.無參建立 2.有參建立 3.結果集與out 4.python的呼叫 1.無參建立 delimiter create procedure p1 begin select from t1 insert into teacher tname values ct end delimiter ...

mysql 密碼忘記 MySQL忘記密碼??怎麼辦

再開啟另外乙個cmd視窗,同樣是進入到mysql的bin目錄,如果已經將mysql的bin目錄配置到環境變數中,可以直接輸入mysql命令 c mysql 5.7.19 winx64 bin mysql welcome to the mysql monitor.commands end with o...