shell
#!/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