国内对企业网站开发的研究,产品外贸营销推广方案,如何做自己网站,做网站鼎盛今天我们主要是讲一下关于linux忘记mysql密码处理方法#xff0c;下面提供了5种linux忘记mysql密码找回方法哦。方法一(先进入root权限)#xff1a;# /etc/init.d/mysql stop# mysqld_safe --usermysql --skip-grant-tables --skip-networking # mysql -u rootmysql…今天我们主要是讲一下关于linux忘记mysql密码处理方法下面提供了5种linux忘记mysql密码找回方法哦。方法一(先进入root权限)# /etc/init.d/mysql stop# mysqld_safe --usermysql --skip-grant-tables --skip-networking # mysql -u rootmysql update user set passwordpassword(newpassword) where user‘root‘;mysql flush privileges;mysql quit# /etc/init.d/mysql restart# mysql -uroot -penter password: mysql方法二直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码:# mysql -udebian-sys-maint -penter password: mysql update user set passwordpassword(newpassword) where userroot;mysql flush privileges;mysql quit# mysql -uroot -penter password: mysql方法三这种方法我没有进行过测试因为我的root用户默认密码已经被我修改过了那位有空测试一下把结果告诉我谢谢# mysql -uroot -penter password: 方法四方法如下 1 关闭mysql服务 /etc/init.d/mysqld stop 2使用 –skip-grant-tables选项启动mysql服务,可以修 改/etc/inin.d/mysqld脚本启动位置增加此选项 vi /etc/init.d/mysqld方法如下1 关闭mysql服务/etc/init.d/mysqld stop2使用 –skip-grant-tables选项启动mysql服务,可以修 改/etc/inin.d/mysqld脚本启动位置增加此选项vi /etc/init.d/mysqld在下面运行启动的语句里增加--skip-grant-tables/usr/bin/mysqld_safe --skip-grant-tables --datadir$datadir --socket$socketfile--log-error$errlogfile --pid-file$mypidfile加入--skip-grant-tables的意思是启动mysql服务的时候跳 过权限表认证。启动后连接到mysql的root不需要口令3,重新启动mysql服务/etc/init.d/mysqld start4. 修改root用户的密码mysql update mysql.user set passwordpassword(123456)where userrootmysql flush privilegesmysql quit5. 重新启动mysql就可以使用 新密码登录了。mysqlmysql -u root –p输入密码1234566关闭mysql服务/etc/init.d/mysqld stop7 重新修改第2步修改的/etc/init.d/mysqld使其保持原来不变也就是取消--skip-grant-tables语句8,重新 启动mysql服务/etc/init.d/mysqld start后记:新安装的MySQL是有密码的,但是其实自动存储在了某个文件夹中,我安装的是MySQL-server-5.6.35-1.el6.x86_64.rpm,rpm安装方式,MySQL的root密码;默认的密码存在:/root/.mysql_secret 这个文件夹中.///但是我就是打不开.SO..,就当忘记密码,如何找回MySQL的初始的root密码.找到的方法都是可行的,但是唯一不好的是可能我这个版本的设置newpasswd的时候新的密码需要用双引号,而原博主没有.所以转过来备自己使用.