M
M
Maxim Sivakon2019-06-26 14:41:28
MySQL
Maxim Sivakon, 2019-06-26 14:41:28

(Errcode: 2) Why doesn't mysql start automatically after server reboot?

For Bitrix it was necessary to update mysql. It has been updated accordingly!
After starting through the command in the SSH console, I entered

systemctl start mysql

After this error appears.

Jun 26 11:24:20 server mysqld[3174]: 2019-06-26 11:24:20 47780976727808 [ERROR] mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' ( Errcode: 2 "No such file or directory")
Jun 26 11:24:20 server systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE
Jun 26 11:24:21 server systemd [1]: Unit mariadb.service entered failed state.server.
Jun 26 11:24:21 server systemd[1]: mariadb.service failed.

Solved this issue by hand!
I create a mysqld folder along this path /var/run/
and after that I write commands
chown mysql /var/run/mysqld
chmod 755 /var/run/mysqld

I repeat the launch
systemctl start mysql

Successfully! This was not the case before. That is, after rebooting the server, you have to do exactly these manipulations!
How can I fix this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
vlarkanov, 2019-06-26
@vlarkanov

Wang that /var/run is mounted in /tmp. This is true?
If yes, then it is logical that the /var/run/mysqld directory disappears after a reboot (/tmp is cleared every time, after all).
Then there are two ways:
1) Don't mount /var/run in /tmp (it's not a fact that nothing will break if the distro is configured this way by default);
2) In the mysql config, change the paths in the socket and pid-file variable:

socket=/var/lib/mysql/run/mysqld.sock
pid-file=/var/lib/mysql/run/mysqld.pid

Don't forget to create the /var/lib/mysql/run/ directory and give it the right permissions.

B
Boris Korobkov, 2019-06-26
@BorisKorobkov

For autoloading, you need to run it once:
Probably, you have already done this. And the problem is that someone dropped chmod / chown during the update

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question