#!/usr/bin/perl # -*- mode: cperl; coding: utf-8; -*- use strict; use warnings; use utf8; use lib "/h/hamren/src/post/lib", "."; my $rval = do "common.pm" || die "$0: common.pm failed ($!) [$@]"; #--- Single-line common initializer #--- End of header post( header(), p("This may not be obvious from the documentation, but is quite simple once we know how to. We need to"), ul( "Put some commands in a file", "Stop the MySQL server daemon.", "Briefly run the server with an --init-file", "Start the server", ), p("Put these commands in a file /tmp/foo:"), source_codeq(<<'EOF'), UPDATE mysql.user SET password=PASSWORD('very-secret-password') WHERE user='root'; FLUSH PRIVILEGES; EOF p("Then run these commands as root:"), source_codeq(<<'EOF'), # /etc/init.d/mysqld stop # /usr/libexec/mysqld --init-file=/tmp/foo & # killall mysqld # /etc/init.d/mysqld start EOF p("Command details will vary between Linux distributions."), p("The killall command is used because the init script can only stop the server if the server has been started also by the init script. Not to worry; the server will catch the signal and shut down cleanly."), p("That's it!"), footer() );