I have a VPS running Centos7 with MariaDB. I am having issues trying to get it to start MariaDB on boot, I am binding MariaDB to my VPS's private address as I only want it to listen to connections on that interface. It fails with this in the logs:
170204 15:34:03 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
170204 15:34:12 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
170204 15:34:13 [Note] /usr/libexec/mysqld (mysqld 5.5.52-MariaDB) starting as process 784 ...
170204 15:34:13 InnoDB: The InnoDB memory heap is disabled
170204 15:34:13 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170204 15:34:13 InnoDB: Compressed tables use zlib 1.2.7
170204 15:34:13 InnoDB: Using Linux native AIO
170204 15:34:13 InnoDB: Initializing buffer pool, size = 128.0M
170204 15:34:13 InnoDB: Completed initialization of buffer pool
170204 15:34:13 InnoDB: highest supported file format is Barracuda.
170204 15:34:13 InnoDB: Waiting for the background threads to start
170204 15:34:14 Percona XtraDB (http://www.percona.com) 5.5.49-MariaDB-38.0 started; log sequence number 1597945
170204 15:34:14 [Note] Plugin 'FEEDBACK' is disabled.
170204 15:34:14 [Note] Server socket created on IP: '10.99.0.14'.
170204 15:34:14 [ERROR] Can't start server: Bind on TCP/IP port. Got error: 99: Cannot assign requested address
170204 15:34:14 [ERROR] Do you already have another mysqld server running on port: 3306 ?
170204 15:34:14 [ERROR] Aborting
170204 15:34:14 InnoDB: Starting shutdown...
170204 15:34:15 InnoDB: Shutdown completed; log sequence number 1597945
170204 15:34:15 [Note] /usr/libexec/mysqld: Shutdown complete
However, I am able to start the service manually by running sudo systemctl start mariadb
which produces:
170204 15:34:15 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
170204 15:38:52 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
170204 15:38:52 [Note] /usr/libexec/mysqld (mysqld 5.5.52-MariaDB) starting as process 2609 ...
170204 15:38:52 InnoDB: The InnoDB memory heap is disabled
170204 15:38:52 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170204 15:38:52 InnoDB: Compressed tables use zlib 1.2.7
170204 15:38:52 InnoDB: Using Linux native AIO
170204 15:38:52 InnoDB: Initializing buffer pool, size = 128.0M
170204 15:38:52 InnoDB: Completed initialization of buffer pool
170204 15:38:52 InnoDB: highest supported file format is Barracuda.
170204 15:38:52 InnoDB: Waiting for the background threads to start
170204 15:38:53 Percona XtraDB (http://www.percona.com) 5.5.49-MariaDB-38.0 started; log sequence number 1597945
170204 15:38:53 [Note] Plugin 'FEEDBACK' is disabled.
170204 15:38:53 [Note] Server socket created on IP: '10.99.0.14'.
170204 15:38:53 [Note] Event Scheduler: Loaded 0 events
170204 15:38:53 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.52-MariaDB' socket: '/var/lib/mysql/mysql.sock' port: 3306 MariaDB Server
My my.cnf:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
bind-address = 10.99.0.14
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
I temporarily disabled SELinux to see if this was the issue, however it didn't seem to fix the issue. It works fine when I bind to 0.0.0.0 but I don't particularly want to do that. Thanks in advance.
Best Answer
I ended up fixing this by adding network-online.target to the
/usr/lib/systemd/system/mariadb.service
file, under the unit directive:Originally, it was set to
network.target
. Basically the eth1 interface wasn't getting an IP address fast enough, causing MariaDB to complain on boot.Thanks @nickm