Bug 1155700 - systemctl start mysqld returns before socket is ready
Summary: systemctl start mysqld returns before socket is ready
Alias: None
Product: Fedora
Classification: Fedora
Component: mariadb
Version: 21
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Jan Staněk
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2014-10-22 16:22 UTC by Pavel Sedlák
Modified: 2014-11-13 18:12 UTC (History)
4 users (show)

Fixed In Version: mariadb-10.0.14-7.fc21
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2014-11-13 18:12:44 UTC
Type: Bug

Attachments (Terms of Use)

Description Pavel Sedlák 2014-10-22 16:22:27 UTC
When mariadb is started via mysqld service name, it does not blocks until it gets ready.

> systemctl stop mysqld; systemctl start mysqld; mysql -u root -S/var/lib/mysql/mysql.sock
fails with
> ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "No such file or directory")

unlike when doing it via mariadb service name:
> systemctl stop mariadb; systemctl start mariadb; mysql -u root -S/var/lib/mysql/mysql.sock
results in
> Welcome to the MariaDB monitor.  Commands end with ; or \g.
> Your MariaDB connection id is 3
> Server version: 10.0.14-MariaDB MariaDB Server
> ...

Happens with mariadb-server-10.0.14-6.fc21.x86_64.
As possible fix/workaround seems it's enough to add
After=mariadb.service to mysqld.service file, like:
> --- /usr/lib/systemd/system/mysqld.service      2014-10-22 16:20:26.475000000 +0000
> +++ /usr/lib/systemd/system/mysqld-fix.service  2014-10-22 16:20:24.042000000 +0000
> @@ -1,6 +1,7 @@
>  [Unit]
>  Description=MySQL compatibility service (another name for mariadb.service; you should use mariadb.service instead)
>  BindsTo=mariadb.service
> +After=mariadb.service
>  [Service]
>  Type=oneshot
then do systemctl daemon-reload, and even version with "mysqld" as service name works.

Comment 1 Jan Staněk 2014-10-24 12:27:34 UTC
I appplied your proposed fix and can confirm that it is working.

Comment 2 Fedora Update System 2014-10-27 08:23:36 UTC
mariadb-10.0.14-7.fc21 has been submitted as an update for Fedora 21.

Comment 3 Fedora Update System 2014-10-28 10:07:17 UTC
Package mariadb-10.0.14-7.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing mariadb-10.0.14-7.fc21'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2014-11-13 18:12:44 UTC
mariadb-10.0.14-7.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.