日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

linux下 mysql 忘记root用户密码解决办法

發(fā)布時(shí)間:2023/12/13 数据库 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux下 mysql 忘记root用户密码解决办法 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

一、以系統(tǒng)的root用戶(什么,你的系統(tǒng)的root用戶密碼也忘了。那只好看我另外一篇linux下忘記root用戶的解決辦法了先解決這個(gè)問題)登陸系統(tǒng),進(jìn)入終端

[root@localhost /]#

二、殺掉mysql進(jìn)程

方法1、[root@localhost /]#killall mysqld

方法2、[root@localhost /]#ps -aux //查看所有進(jìn)程,找到mysql進(jìn)程的pid

然后

[root@localhost /]#kill pid //pid是mysql的進(jìn)程號(hào)

三、用--skip-grant-tables參數(shù)啟動(dòng)mysqld

[root@localhost /]#/usr/local/mysql/bin/mysqld_safe --skip-grant-tables&

// 其中/usr..../bin是我的mysql安裝目錄

[root@localhost /]#/usr/local/mysql/bin/mysql //進(jìn)入mysql

mysql> use mysql //切換到mysql database

mysql> UPDATE user SET password=password('123456') WHERE user='root';

//將root密碼該為123456了

四、注意事項(xiàng)

The full command to load MySQL like this is:

mysqld_safe --skip-grant-tables --autoclose

(Editor's Note: Our technical reviewer found that he had to launch the mysqld_safe command

without the '--autoclose' flag, otherwise the daemon never started.)

這是國外網(wǎng)站說的,我沒用autoclosa也成功了

但是我在執(zhí)行/usr/local/mysql/bin/mysqld_safe --skip-grant-tables&即出現(xiàn)錯(cuò)誤提示:

./mysqld_safe

starting mysqld daemon with databases from /usr/local/var

STOPPING server from pid file /usr/local/var/localhost.localdomain.pid

mysqld ended

然后進(jìn)入/usr/local/var/

vi ./localhost.localdomain.err 內(nèi)容如下:

050410 04:02:59 mysqld started

050410 4:03:00 InnoDB:Operating system error number 13 in a file operation.

InnoDB:The error means mysqld does not have the access rights to

InnoDB:the directory.

InnoDB:File name ./ibdata1

InnoDB:File operation call:'create'.

InnoDB:Cannot continue operation.

050410 04:03:00 mysqld ended

懷疑是./var目錄的訪問權(quán)限,故如下操作:

chmod 777 ./var

然后重新執(zhí)行后臺(tái),仍出以上錯(cuò)誤,但在localhost.localdomain.err文件中的錯(cuò)誤信息已改為找不到一個(gè)叫做

help.*的文件了(這個(gè)文件名我記不得了)

這是因?yàn)槲业膍ysql安裝目錄的讀寫權(quán)限是這樣造成的

mysql安裝目錄屬于用戶root,但是群組是mysql的

把群組也改為root即可。

轉(zhuǎn)載于:https://www.cnblogs.com/myphoebe/archive/2011/11/01/2231002.html

總結(jié)

以上是生活随笔為你收集整理的linux下 mysql 忘记root用户密码解决办法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。