B.5.4.1.3 Resetting the Root Password: Generic Instructions
The preceding sections provide password-resetting instructions for Windows and Unix systems. Alternatively, on any platform, you can reset the password using the mysql client (but this approach is less secure):-
Stop the MySQL server if necessary, then restart it with
the
--skip-grant-tables
option. This enables anyone to connect without a password and with all privileges, and disables account-management statements such asSET PASSWORD
. Because this is insecure, you might want to use--skip-grant-tables
in conjunction with--skip-networking
to prevent remote clients from connecting. -
Connect to the MySQL server using the
mysql client; no password is
necessary because the server was started with
--skip-grant-tables
:
shell>
mysql
-
In the
mysql
client, tell the server to reload the grant tables so that account-management statements work:
mysql>
Then change theFLUSH PRIVILEGES;
'root'@'localhost'
account password. Replace the password with the password that you want to use. To change the password for aroot
account with a different host name part, modify the instructions to use that host name.
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');
root
using the new password. Stop the
server and restart it normally (without the
--skip-grant-tables
and
--skip-networking
options).##############
Stop mysql
[root@Goautodial ~]# service mysqld stop
Step # 2: Start to MySQL server w/o password:
# mysqld_safe --skip-grant-tables
Output:
[1] 5988 Starting mysqld daemon with databases from /var/lib/mysql mysqld_safe[6025]: started
If the above command get frozen press control + z and then reconect to mysql with no password
Now conect to MYSQL
[root@Goautodial ~]#mysql
mysql> FLUSH PRIVILEGES;
Now reset the passmysql>SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');
restart mysql
service mysqld restart
reconect
mysql -u root -p
https://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html
No hay comentarios:
Publicar un comentario