大网数据广告活动
服务器运维问答

Digital Ocean CentOS7 server, unable to --skip-grant-tables or restart mysql

· 52CE 我爱测

I set up a Digital Ocean droplet (server) a few days ago and need to access mysql. No password for root is working amongst what I've tried. However this command: service mysql[d] stop Doesn't work. Apparently I am supposed to iss…

问题原文

原帖链接 · Oliver Williams · CC BY-SA 3.0

I set up a Digital Ocean droplet (server) a few days ago and need to access mysql. No password for root is working amongst what I've tried. However this command:

service mysql[d] stop

Doesn't work. Apparently I am supposed to issue this command:

sudo systemctl stop mariadb.service

But that results in

Failed to stop mariadb.service: Unit mariadb.service not loaded.

Furthermore, this command

mysqld_safe --skip-grant-tables --skip-networking & mysql -u root

Results in these responses:

sudo: mysqld_safe: command not found
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[1]+  Exit 1   sudo mysqld_safe --skip-grant-tables --skip-networking

I am logged into the server as root; what do I do from here?

社区高分解答

原帖链接 · Anthony Fornito · CC BY-SA 3.0

Try

yum remove mysql

Then try

service mariadb restart

Then look at the out from

service mariadb status

You should see it running then the commands your tried early should work

if

 yum remove mysql

does not work Try

 chkconfig mysql off

Reboot and try to start maria again.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-12-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。