Skip to content

Instantly share code, notes, and snippets.

@MaxSouza
Created April 18, 2018 01:55
Show Gist options
  • Save MaxSouza/957072bfe643b860ab6a8b42dac3e86d to your computer and use it in GitHub Desktop.
Save MaxSouza/957072bfe643b860ab6a8b42dac3e86d to your computer and use it in GitHub Desktop.
Resetando a senha do mysql macos
If you don't remember the password you set for root and need to reset it, follow these steps:
Stop the mysqld server, this varies per install
Run the server in safe mode with privilege bypass
sudo mysqld_safe --skip-grant-tables;
In a new window connect to the database, set a new password and flush the permissions & quit:
mysql -u root
For MySQL older than MySQL 5.7 use:
UPDATE mysql.user SET Password=PASSWORD('your-password') WHERE User='root';
For MySQL 5.7+ use:
USE mysql;
UPDATE mysql.user SET authentication_string=PASSWORD("your-password") WHERE User='root';
Refresh and quit:
FLUSH PRIVILEGES;
\q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment