MySQL and PostgreSQL have been updated to use native systemd unit files for startup, in place of the SysV-style init scripts. This should eliminate various unfortunate problems that occurred in Fedora 15 due to systemd's rather poor handling of SysV scripts. Also, handling of cases where the database server is slow to start up is significantly better than it ever was in the SysV scripts, since systemd can just wait until the server is really ready without slowing the boot down.
The service postgresql initdb
and service postgresql upgrade
actions that were supported by the SysV init script cannot be provided by the systemd unit file. There is a new standalone script, postgresql-setup
that provides these functions. For example, to initialize a new postgresql database, do something like
sudo postgresql-setup initdb
If you need to run more than one postgresql server on the same machine, you can duplicate and modify the postgresql.service
file, as is customary with systemd services. (Remember that custom service files should go into /etc/systemd/system/
not /lib/systemd/system/
.) Notice that PGDATA and PGPORT settings for alternate servers must now be specified in the custom service files.
Copy /lib/systemd/postgresl.service
to /etc/systemd/myservice.service
, adjust PGDATA and PGPORT in the new file. To set it up, run
sudo postgresql-setup initdb myservice
postgresql-setup
will then extract the PGDATA setting from that service file instead of postgresql.service
.
The files in /etc/sysconfig/pgsql/
are no longer used.