Skip to content

Instantly share code, notes, and snippets.

@crafter999
Last active July 2, 2019 22:51
Show Gist options
  • Save crafter999/e21803a09b8bf7d5d0f88ad7f249e61a to your computer and use it in GitHub Desktop.
Save crafter999/e21803a09b8bf7d5d0f88ad7f249e61a to your computer and use it in GitHub Desktop.
Disable mysql timeout after 8 hours (mysql)
#!/bin/bash
# Needed variables: host and username
if [ -z "$1" ] || [ -z "$2" ] ; then
echo "Usage: ./mysql-noTimeout.sh 127.0.0.1 myDatabaseUsername"
else
mysql -h "$1" -u "$2" -e '
SET wait_timeout=31536000;
SET interactive_timeout=31536000;
SET GLOBAL wait_timeout=31536000;
SET GLOBAL interactive_timeout=31536000;
show variables like "%timeout%";
' -p
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment