Web Designing, Web Development, Website Design, Website Development, SEO

0091 98233 72069

COGS: CUSTOMISED, OPTIMISED, GENERALISED WEB DESIGN & WEB DEVELOPMENT SOLUTIONS

Resetting a forgotten MySQL root password

  1. Stop mysqld and restart it with the --skip-grant-tables option.
  2. to start use # /usr/bin/mysqld_safe --skip-grant-tables
  3. Connect to the mysqld server with this command:(you may have to use new shell / window for this)
    shell> mysql
  4. Issue the following statements in the mysql client. Replace the password with the password that you want to use.
    mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass')
        ->                   WHERE User='root';
    mysql> FLUSH PRIVILEGES;
  5. stop mysqld server using service mysqld stop - make sure to stop and restart so that new service will be password protected
  6. restart server with service mysqld start