I
I
i_want_to_know_everything2017-09-23 08:40:50
MySQL
i_want_to_know_everything, 2017-09-23 08:40:50

Restoring root in mysql?

Unknown MySQL root password
trying to recover by running MySQL without checking privileges
Here is the log

[email protected]***-**-**:~# /etc/init.d/mysql stop
[ ok ] Stopping mysql (via systemctl): mysql.service.
[email protected]***-**-**:~# mysqld_safe --skip-grant-tables &
[1] 5751
[email protected]***-**-**:~# 170922 22:33:02 mysqld_safe Logging to syslog.
170922 22:33:02 mysqld_safe A mysqld process already exists
[email protected]***-**-**:~# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[1]+  Exit 1                  mysqld_safe --skip-grant-tables
[email protected]***-**-**:~#

As I understand it, there is no root at all? How to be?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Dart, 2017-09-23
@i_want_to_know_everything

Log in as the server root, then type the following commands:

/etc/init.d/mysql stop

/etc/init.d/mysql start --skip-grant-tables

mysqladmin -u root password "newpassword"

/etc/init.d/mysql stop

/etc/init.d/mysql start

Valid for debian, other OS paths may be different

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question