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 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退
  • ¥20 win系统的PYQT程序生成的数据如何放入云服务器阿里云window版?
  • ¥50 invest生境质量模块