Skip to content

Instantly share code, notes, and snippets.

@airborne-commando
Created November 6, 2022 15:49
Show Gist options
  • Select an option

  • Save airborne-commando/3e7210bb2e3bfcd55dc52a6eaa170162 to your computer and use it in GitHub Desktop.

Select an option

Save airborne-commando/3e7210bb2e3bfcd55dc52a6eaa170162 to your computer and use it in GitHub Desktop.
a simple mySQL installer
#!/bin/bash
if [ $EUID -ne 0 ]
then
echo "This program must run as root to function."
exit 1
fi
# to see if the service is already started
systemctl start mysql.service &&
echo "enter in ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Password'; then enter/type in exit;"
echo "Change the password as soon as you start the secure installation."
mysql &&
#echo "resetting the mysql service..."
#systemctl restart mysql.service --now &&
# mysql -u root -p &&
echo "ok to set up the service, now you'll need to "
# commented out, locks me out of the database
# echo "mysql -u<ser> root -p<assword> enter the command"
#
# commented out, because it's used with the command above; also locks me out.
# echo "ALTER USER 'root'@'localhost' IDENTIFIED WITH auth_socket; then enter/type in exit"
#
echo "continue the install with"
echo "sudo mysql_secure_installation"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment