- Stop mysqld and restart it with the
--skip-grant-tablesoption. -
to start use # /usr/bin/mysqld_safe --skip-grant-tables
- Connect to the mysqld server with this command:(you may have to use new shell / window for this)
shell>
mysql - 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; - stop mysqld server using service mysqld stop - make sure to stop and restart so that new service will be password protected
- restart server with service mysqld start