06 Sep 2012

reset password mysql in freebsd

if you have forgotten in your Mysql Password,so this is a solution :

 

first step > stop your mysql server

~#/usr/local/etc/rc.d/mysql-server onestop

second step > starting your mysql on this script

~#mysqld_safe --skip-grant-tables &

third step >then,get into mysql wihtout checks tables

~#mysql -u root
mysql>use mysql;        {ENTER}

fourth step>

mysql>update user set Password=Password('123456') where user='root';
mysql>flush privileges;
mysql>quit

 

fifth step > looking for the PID of MYSQL and then stop

~#ps ax | grep mysql
896 ?? Is 0:00.01 /bin/sh /usr/local/bin/mysqld_safe –defaults-extra-fil
945 ?? I 0:01.26 /usr/local/libexec/mysqld –defaults-extra-file=/var/db
1610 1 D+ 0:00.00 grep mysql
#

{THIS IS A SAMPLE PID}

sixth step > kill PID

-# kill -9 896 945

seventh > start the mysql

~#/usr/local/etc/rc.d/mysql-server start
Starting mysql

FINISH

TRY IT



    
        
        

                    

Leave a Reply