9

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?

Oliver Williams
  • 276
  • 3
  • 13

1 Answers1

10

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.

Anthony Fornito
  • 9,526
  • 1
  • 33
  • 122
  • No success with the first part. I got: [root@centos-8gb-nyc2-01 ~]# service mariadb restart -- Redirecting to /bin/systemctl restart mariadb.service -- Failed to restart mariadb.service: Unit mariadb.service failed to load: No such file or directory. [root@centos-8gb-nyc2-01 ~]# service mariadb status Redirecting to /bin/systemctl status mariadb.service ● mariadb.service Loaded: not-found (Reason: No such file or directory) Active: inactive (dead) – Oliver Williams Dec 06 '16 at 19:46
  • `ckconfig` only results in a -bash: command not found error. – Oliver Williams Dec 06 '16 at 19:46
  • chkconfig <-- forgot the h – Anthony Fornito Dec 06 '16 at 19:51
  • After reboot try yum install mariadb – Anthony Fornito Dec 06 '16 at 19:52
  • chkconfig only works on sysv services You need to use `systemctl enable`. – user9517 Dec 06 '16 at 20:02