Cheap Web Space, Domain Name:
Web Space With E-Mail, PHP/MySQL.

I have lost the root password to MySQL. How can I replace it?

Question: 

Searching …

 

Unfortunately nothing found on "".

Premium support for Bitpalace web hosting customers only!

 from the Dominican Republic: +49 30 32 70 18 92, Fax (in Germany) +49 30 32 70 18 91

service@bitpalast.net 

Skype: bitpalast

One moment please … your browser is loading the page.

 

 

Solution

1. Log-in to your server by SSH and switch to superuser mode.

2. Stop the MySQL service mysqld.

FreeBSD:
/usr/local/etc/rc.d/mysql-server stop

Linux:
service mysqld stop

3. Restart the service manually, but add the "--skip-grant-tables" parameter, e.g.

/bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql --skip-grant-tables --user=root

The SSH might not return to the shell prompt, because I/O is redirected by MySQL. Simply close the SSH connection and open a new one, log in again and switch to superuser mode.

4. Log-in to the MySQL console without password:

mysql -u root

5. Set a new password with this SQL command:

UPDATE mysql.user SET password=PASSWORD('[new password]') WHERE user='root';
FLUSH PRIVILEGES;


Instead of [new password] enter a password of your choice. Special characters may lead to problems later on. It is often better to omit them.

6. Leave the MySQL console:

exit;

7. Stop the MySQL service mysqld once again:

FreeBSD:
/usr/local/etc/rc.d/mysql-server stop

Linux:
service mysqld stop

8. Restart the service manually, but this time omit the "--skip-grant-tables" parameter. It may be best to use the simplified start command:

FreeBSD:
/usr/local/etc/rc.d/mysql-server start

Linux:
service mysqld start

The new root password is now active.

 

Overview of frequently asked questions 

 

 

 


 

  from the Dominican Republic: +49 30 32 70 18 92 •  GmbH, Sensburger Allee 27, D-14055 Berlin (Germany)
Your purchase is tax-free, because you order from a non-EU country. © 2024  GmbH. All rights reserved. and the logo are registered trademarks of GmbH. For photo credits see imprint.

Imprint Privacy policy Sitemap