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

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?


Solution 1:

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.