Posts filed under ‘MySQL’

Changing MySQL 5.0 root password in FreeBSD 7.2-RELEASE

So you have forgotten your mysql root password and you now have no access on you mysql server.

Here are the steps to set a new root password. (you need root privileges)

1. Stop the mysql database server
/usr/local/etc/rc.d/mysql-server stop

2. Start mysql and bypass the authentication
/usr/local/libexec/mysqld --skip-grant-tables --skip-networking --user=root &

3. Log in to mysql (without password)
mysql -h localhost -u root

4. When you’re logged and in the mysql command prompt, you set the password.
use mysql;
update user set password=password( 'yournewpassword' ) where user='root';
flush privileges;
exit;

5. Stop mysql by process id (PID)
ps ax | grep mysql
Result
34666 p0 I 0:01.53 /usr/local/libexec/mysqld --skip-grant-tables --skip-networking --user=root &
kill -TERM 34666

5. Start mysql via /usr/local
/usr/local/etc/rc.d/mysql-server start

6. Log to mysql and use your new root password
mysql -h localhost -u root -p

7. Enjoy

06.02.2009 at 2:21 am Leave a comment


 

June 2012
M T W T F S S
« Apr    
 123
45678910
11121314151617
18192021222324
252627282930  

Blog Stats

  • 16,297 hits

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 4 other followers


Follow

Get every new post delivered to your Inbox.