duangan9251 2018-08-02 01:30
浏览 208

重置root密码时sudo mysqld_safe --skip-grant-tables&,/ var / lib / mysql错误

I've been trying to reset my forgotten root password in mysql. When I first tried to stop my mysqld service and tried mysqld --skip-grant-tables I got this error

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

(2) Ask Question the same problem here

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2).

The top comment said to do something with the my.conf file and I found it here

orpheus@Roedelius:/etc/mysql$ ls
conf.d      debian-start  my.cnf.fallback  mysql.conf.d
debian.cnf  my.cnf        mysql.cnf

I did'nt know what to do from here with the my.cnf file.

opened my.cnf file in it has this in it besides comments -

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

so I tried the same method of restarting my mysql server and stopping it, then using --skip-grant-tables, but I got this error that time -

  2017-02-10T17:05:44.870970Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2017-02-10T17:05:44.872874Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2017-02-10T17:05:44.874547Z mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists

the same problem here mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists . I followed the top answers steps doing this mkdir -p /var/run/mysqld chown mysql:mysql /var/run/mysqld and then tried getting into mysql with --skip-grant-tables again but now I'm getting this error

orpheus@Roedelius:/$ sudo mysqld_safe --skip-grant-tables &
[2] 17057
orpheus@Roedelius:/$ 2018-08-02T01:11:46.843096Z mysqld_safe Logging to syslog.
2018-08-02T01:11:46.845788Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2018-08-02T01:11:46.859083Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

My terminal just says that now and not letting my type anything. All the answers I'm finding on stackoverflow to reset my root password just keep leading to errors and I'm not sure if Im breaking some things by following some of the directions to fix these errors. I'd appreciate any help with my current error and resetting my root password.

  • 写回答

1条回答 默认 最新

  • dsn1327 2018-08-02 01:36
    关注

    That's not an error: you've started the MySQL server. Now you need to talk to it!

    Options:

    1. Open ANOTHER terminal window, and connect using "mysql" and update your password, or
    2. Use "nohup" by running hohup mysqld_safe --skip-grant-tables & (as sudo) as that will return control to your terminal where you can then connect.
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?