1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
#!/bin/sh
[ -z "$ADTTMP" ] || cd $TDIR
rm -rf ${MYSQL_DIR}
# redirect STDERR to STDIN, autopkgtest fails otherwise
if mysql --version | grep -q MariaDB; then
mysql_install_db --no-defaults --datadir=${MYSQL_DIR} --force --skip-name-resolve --explicit_defaults_for_timestamp --user=${MYSQL_USER} 2>&1
else
/usr/sbin/mysqld --no-defaults --initialize --datadir=${MYSQL_DIR} --explicit_defaults_for_timestamp --user=${MYSQL_USER} 2>&1
fi
/usr/sbin/mysqld --no-defaults --user=${MYSQL_USER} --socket=${MYSQL_UNIX_PORT} --datadir=${MYSQL_DIR} --pid-file=${MYSQL_PIDFILE} --explicit_defaults_for_timestamp --skip-networking --skip-grant-tables 2>&1 &
attempts=0
while ! /usr/bin/mysqladmin --socket=${MYSQL_UNIX_PORT} ping 2>&1 ; do
sleep 3
attempts=$((attempts+1))
if [ ${attempts} -gt 10 ] ; then
echo "skipping test, mariadb/mysql server could not be contacted after 30 seconds"
exit 1
fi
done
mysql --socket=${MYSQL_UNIX_PORT} --execute "CREATE DATABASE IF NOT EXISTS ${MYSQL_DBNAME};" 2>&1
# fails because mysqld is started with --skip-grant-tables
# (without there's only a passwordless unix-sockety root account)
#mysql --socket=${MYSQL_UNIX_PORT} --execute "GRANT ALL PRIVILEGES ON ${MYSQL_DBNAME}.* TO '${MYSQL_USER}'@'localhost' IDENTIFIED BY '${MYSQL_PASS}';" 2>&1
|