Skip to content

Instantly share code, notes, and snippets.

@maltzsama
Created April 16, 2013 13:41
Show Gist options
  • Select an option

  • Save maltzsama/5395981 to your computer and use it in GitHub Desktop.

Select an option

Save maltzsama/5395981 to your computer and use it in GitHub Desktop.
recover MySQL root password
#1 - Pare o serviço do MySQL:
$service mysqld stop
#2 - Inicie o MySQL sem senha:
$mysqld_safe --skip-grant-tables
#3 - Conecte ao MySQL usando o mysqlclient:
$mysql -u root
#4 - Configure uma nova senha para o MySQL:
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit
#5 - Reinicie o serviço do MySQL:
$service mysqld restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment