Created
September 23, 2016 18:37
-
-
Save greglamb/03a14433f065c71eac59f6d86e1371a9 to your computer and use it in GitHub Desktop.
mysqld
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| systemctl stop mysqld | |
| /usr/sbin/mysqld --skip-grant-tables --user=mysql & | |
| sleep 10 | |
| echo "update mysql.user set authentication_string=password('') where user='root';" | mysql | |
| echo "FLUSH PRIVILEGES;" | mysql | |
| PID=`ps -ef | grep skip-grant-tables | grep -v grep | awk '{print $2}'` | |
| while [ "$PID" != "" ];do | |
| kill "$PID" | |
| PID=`ps -ef | grep skip-grant-tables | grep -v grep | awk '{print $2}'` | |
| sleep 1 | |
| done | |
| systemctl start mysqld | |
| mysql_secure_installation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment