I've created a script to cleanup InnoDB
storage engine. Everything works fine except that creating the ib_logfile0
and ib_logfile1
files when innodb_log_file_size
is set to 1GB
takes a while which causes /etc/init.d/mysql
to timeout and report a failure, although in the background MySQL
ends up starting normally.
Starting mysql
$ /etc/init.d/mysql start
* Starting MariaDB database server mysqld [fail]
Meanwhile in the logs
$ tail -f /var/log/mysql.err
120426 11:19:55 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 1024 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000
120426 11:20:07 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 1024 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000
[...]
120426 11:20:24 [Note] /usr/sbin/mysqld: ready for connections.
# Version: '5.5.23-MariaDB-mariadb1~oneiric-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
I am looking for a way to prevent the startup script from timing out. When I look at /etc/init.d/mysql
, I can see the ${MYSQLD_STARTUP_TIMEOUT}
variable but don't know where it is set. I've also been looking in the documentation for such an option but couldn't find it.
Q1: Can I specify a custom startup timeout as a parameter to /etc/init.d/mysql
?
Q2: What option can I modify to change the server startup timeout in the configuration?
I know this is an old question, but I'm posting in case anyone else is looking for a better/different answer. I've been having a similar problem, but when installing upgrades. Ours takes a long time to start as it is part of a Galera cluster and needs to copy over what it missed while it was down.
To start run:
or on a system with
service
, like Ubuntu:And in my case, for upgrades call:
You can use the following option on startup:
In your init script or my.cnf it would look like:
More documentation is located here http://dev.mysql.com/doc/refman/5.5/en/mysql-server.html
To time the startup script to see if it's taking the new timeout value, use Linux's time command in conjunction
Compare the reported execution time with the timeout value, see if it changes when you change the timeout, if not, then the option is either not working as expected (maybe MariaDB doesn't support it) or it's declared incorrectly in the config.
On modern distributions systemd is used to start the service. If you have tried
MYSQLD_STARTUP_TIMEOUT
and it has not worked, you are probably using this. The/etc/init.d/mysql
script is no longer used, soMYSQLD_STARTUP_TIMEOUT
has no effect.You need to find your
mariadb.service
file. In our case, it did not contain a timeout so the MariaDB default was being used. Just add:In the
[Service]
section, and it will never time out.It would be a good idea to create your own config file containing this so it doesn't get overwritten by later re-installs.
On ubuntu 18.04, you will find this file in
Put your own drop in file in
Remember to run
systemctl daemon-reload
after adding the timeout somewhere (and maybe check/var/log/syslog
to see if the reload was successful)