Difference between revisions of "Resetting MySQL root password"

From Notes_Wiki
m
m
Line 1: Line 1:
<yambe:breadcrumb>Mysql configuration</yambe:breadcrumb>
=Resetting mysql root password=
=Resetting mysql root password=


Line 10: Line 11:
#Stop mysql using command "service mysqld stop"
#Stop mysql using command "service mysqld stop"
#Start mysql again without any password or with the new password set.
#Start mysql again without any password or with the new password set.
Back to [[Mysql configuration]]

Revision as of 08:08, 2 December 2012

<yambe:breadcrumb>Mysql configuration</yambe:breadcrumb>

Resetting mysql root password

In case we have root privileges on server and want to reset mysql root password then we can use following steps:

  1. Stop mysql service if it is running.
  2. Use command 'mysqld_safe --skip-grant-tables' to run mysql without any priviledge information
  3. Connect to mysql by simply typing 'mysql' without any options
  4. Use database mysql using 'use mysql'
  5. Change root password or disable it using "update user set password=password('secret') where user='root'" or "update user set password= where user='root'"
  6. Stop mysql using command "service mysqld stop"
  7. Start mysql again without any password or with the new password set.