du532861657 2015-12-13 19:45
浏览 90

有没有办法撤消#kill`cat / mysql-data-directory / mysqld.pid`?

So I was trying to reset my MySQL password on my Raspberry Pi and it seems that my database crashed or is now inaccessible.

I was following the section called, “B.5.3.2.2 Resetting the Root Password: Unix and Unix-Like Systems” of the official MySQL documentation.

As soon as I ran:

kill `cat /var/run/mysqld/mysqld.pid`

Then input:

# sudo service mysqld restart

I’d get:

# mysqld: unrecognized service

I hope that I didn’t just nuke my entire database. Can someone help?

  • 写回答

1条回答 默认 最新

  • dongye9182 2015-12-13 20:02
    关注

    You are following generic MySQL instructions for a Linux setup when you are on a Raspberry Pi using Raspbian (I assume).

    All that message means is the service named mysqld is unrecognized by your system. It does not mean it has crashed or data was lost. It just means your OS doesn’t know what mysqld is as far as services go. That’s it; nothing to panic about.

    A quick Google search shows that Raspbian uses a different system service name simply known as mysql. So to start it up again just run this command:

    sudo service mysql start
    

    And you should be good to go. Also note that whole command you ran to stop the service is overkill:

    kill `cat /var/run/mysqld/mysqld.pid`
    

    Running a kill command like that should only happen when all other options are exhausted and you truly want to stop the database server. The way you should be stopping, starting and generally controlling the MySQL server is via the service interface using a command like this:

    sudo service mysql stop
    

    And if you wanted to restart the service, just run this command:

    sudo service mysql restart
    

    Past any of that if you are stuck with an “unrecognized service” message, then you can always check the stuff in the /etc/init.d directory on your Linux machine like this:

    ls -la /etc/init.d/
    

    Look through that list and find the exact name of the service you need to do something with and then just run the service command as outlined above.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。