Skip to content

Instantly share code, notes, and snippets.

@dvl
Created February 1, 2017 00:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvl/0965189dadb635d5e7370d12826359b3 to your computer and use it in GitHub Desktop.
Save dvl/0965189dadb635d5e7370d12826359b3 to your computer and use it in GitHub Desktop.
#!/bin/bash
# de-fuck mysql 5.7
# This script allow you to log on MySQL as root user without use sudo
# sudo apt install postgresql
# sudo apt purge "mysql-*"
# you know, would be better...
sudo mysql -u root -e "CREATE USER 'root2'@'localhost';"
sudo mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'root2'@'localhost' WITH GRANT OPTION;"
mysql -u root2 -e "DROP USER 'root'@'localhost';"
mysql -u root2 -e "CREATE USER 'root'@'localhost';"
mysql -u root2 -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;"
mysql -u root -e "DROP USER 'root2'@'localhost';"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment