- Login to server as root
- kill mysql server pid. In debain you can find pid file in /var/run/mysqld
kill `cat /var/run/mysqld/mysqld.pid`
- Create a text file and add below sql statements to text file. Change 'password' to new password required
UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root'; FLUSH PRIVILEGES;
- Start mysql server with --init-file option
mysqld_safe --init-file=/path/to/textfile &
Now login to mysql using new password
No comments:
Post a Comment