Can#39;t reset root password with --skip-grant-tables on ubuntu 16(无法在 ubuntu 16 上使用 --skip-grant-tables 重置 root 密码)
问题描述
我正在尝试按照 MysqlPasswordReset 重置根密码,但是当我尝试启动服务器时使用 --skip-grant-tables 服务器不会启动
I am trying to reset the root password following MysqlPasswordReset but when I try to start the server with --skip-grant-tables the server doesn't start
- Ubuntu 16.04.1 LTS(GNU/Linux 4.4.0-59-generic x86_64)
- mysql Ver 14.14 Distrib 5.7.17,适用于 Linux (x86_64)
服务器正在运行
停止服务器
尝试从 --skip-grant-tables 开始
Trying to start with --skip-grant-tables
无需密码即可连接
我也尝试从mysql_safe开始(error.log为空)
I also tried to start with mysql_safe (error.log is empty)
推荐答案
我发现mysql服务停止时mysql.sock被删除,mysqld_safe无法创建(我没找到原因),所以我的解决方案是在启动 mysqld_safe 之前备份 sock 文件夹并恢复
I found that the mysql.sock is deleted when the mysql service is stoped and mysqld_safe can't create it (I couldn't find the reason), so my solution was back up the sock folder and restore before start mysqld_safe
启动服务器
进入袜子文件夹
备份袜子
停止服务器
恢复袜子
启动mysqld_safe
Start mysqld_safe
初始化mysql shell
Init mysql shell
修改密码
这篇关于无法在 ubuntu 16 上使用 --skip-grant-tables 重置 root 密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!