Rpj
Rpj

Reputation: 6080

Unable to reset mysql password for my Ubuntu machine

Unable to reset mysql password for my Ubuntu machine. I followed the instruction below.

https://help.ubuntu.com/community/MysqlPasswordReset

But I get the following error

sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking
151109 20:04:43 [Note] /usr/sbin/mysqld (mysqld 5.5.45) starting as process 18720 ...
151109 20:04:43 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

151109 20:04:43 [ERROR] Aborting

151109 20:04:43 [Note] /usr/sbin/mysqld: Shutdown complete

Upvotes: 3

Views: 668

Answers (2)

Sasha Pachev
Sasha Pachev

Reputation: 5326

Try:

sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking --user=mysql

Upvotes: 4

hd1
hd1

Reputation: 34657

Perhaps this page might be of use. I copy-pasted the snippet for generic systems, as you didn't indicate whether you are using Unix or Windows:

  1. 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 as ALTER USER and SET PASSWORD. Because this is insecure, you might want to use --skip-grant-tables in conjunction with --skip-networking to prevent remote clients from connecting.
  2. Connect to the MySQL server using the mysql client; no password is necessary because the server was started with --skip-grant-tables: mysql
  3. In the mysql client, tell the server to reload the grant tables so that account-management statements work: FLUSH PRIVILEGES;

Now you can change the root password like any other user, e.g. using set password or alter user.

Hope that helps...

Upvotes: 2

Related Questions