antivirus
Óptima protección antivirus: Soluciones de seguridad en Internet de G Data para PC.

lunes, 22 de abril de 2013

Recuperar la clave de root del MySQL en Linux

Hay que abrir dos shells en el Linux en el que estemos trabajando:

PRIMER SHELL:

$ sudo service mysql stop
$ sudo mysqld_safe --skip-grant-tables
 
SEGUNDO SHELL:

$ mysql -u root

mysql> use mysql;
mysql> update user set password=PASSWORD("miclavesegura") where User='root';
mysql> flush privileges;
mysql> quit

$ sudo service mysql stop
$ sudo service mysql start
mysql start/running, process 18047

$ ps aux | grep mysql
  root     17790  0.0  0.0   1896   548 pts/2    S+   14:22   0:00 /bin/sh /usr/bin/mysqld_safe --skip-grant-tables

$ sudo kill -9 17790

$ mysql -u root -p

Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 44
Server version: 5.1.61-0ubuntu0.10.10.1 (Ubuntu)
mysql>
mysql> quit

No hay comentarios:

Publicar un comentario