0

I needed to run a program (just a compiled c++ program, not script, i.e., like /var/programname) on startup on CentOS 7.

I followed this guide https://www.howtogeek.com/687970/how-to-run-a-linux-program-at-startup-with-systemd/

Rebooted via reboot command, checked if my program is running via ps aux, it is.

But now, I can't connect to mysql database (maybe there are other problems). I have phpMyAdmin, it running through browser, but when I try to login it throws:

mysqli_real_connect(): (HY000/2002): No such file or directory

Running mysql -u root -p command, after input root password throws:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Have I just deleted databases?(

In /etc/init.d/ currently there are asterisk functions netconsole network README, no mysql or mysqld folder.

1 Answers1

0

The problem was, that mariadb was not enabled in systemctl, i.e. it was not on startup, and hence was not running.

So I ran

systemctl enable mariadb.service, as far as remember (I have done it yesterday)

And rebooted the server, now it run on startup.


As for my program, I need to run on startup, I removed it from systemctl, and going to use crontab for that.