Last active
December 2, 2016 10:23
-
-
Save mtparet/affd5d48a323ab8dca432bc5b0c5399b to your computer and use it in GitHub Desktop.
Reset password mysql 5.7
This file contains 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
#!/usr/bin/env bash | |
set -x | |
set -e | |
sudo service mysql stop || echo "mysql not stopped" | |
sudo stop mysql-5.6 || echo "mysql-5.6 not stopped" | |
sudo mysqld_safe --skip-grant-tables & | |
sleep 4 | |
sudo mysql -e "use mysql; update user set authentication_string=PASSWORD('') where User='root'; update user set plugin='mysql_native_password';FLUSH PRIVILEGES;" | |
sudo kill -9 `sudo cat /var/lib/mysql/mysqld_safe.pid` | |
sudo kill -9 `sudo cat /var/run/mysqld/mysqld.pid` | |
sudo service mysql restart | |
sleep 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://medium.com/@mtparet/install-mysql-server-5-7-on-travis-96f2ebc0f339#.xk3jalgst