Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
537
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. /etc/init.d/mysql stop
  4. sleep 5
  5. mysqld_safe --skip-grant-tables &
  6. sleep 10
  7. mysql -u root -e "use mysql;"
  8. mysql -u root mysql -e "update user set password=PASSWORD("1") where User='root';"
  9. mysql -u root -e "flush privileges;"
  10. /etc/init.d/mysql stop
  11. /etc/init.d/mysql start
  12. mysql -u root -p1 -e "SET PASSWORD FOR root@localhost=PASSWORD('')"
  13. mysql -u root -e "SET PASSWORD FOR root@127.0.0.1=PASSWORD('')"
  14. mysql -u root -e "flush privileges;"
  15. read -p "Type the password you want root to use for MySQL here: " NEWPASSWD
  16. mysqladmin -u root password $NEWPASSWD
  17. echo 'MySQL Password updated successfully for root user.'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement