# mysql mysql
> update user set password=('hello') where user='root';
> quit
# mysqladmin reload
# mysql mysql --password=hello
ERROR 1044: Access denied for user: '[EMAIL PROTECTED]' 
to database 'mysql'

At this point I pondered and worked out I should have used 
password=password('hello'). The prospect of finding a password that 
encrypts to the word 'hello' was now rather daunting. I had to find 
another approach... I believe there is a way to reset the root password 
with a special command but for some reason I decided to be a bit more 
creative.

# /etc/init.d/mysqld stop
# cd /var/lib/mysql
# cp -a mysql/user.* test/
# /etc/init.d/mysqld start
# mysql test
> update user set password=password('hello') where user='root';
> quit
# /etc/init.d/mysqld stop
# cp -a test/user.* mysql
# rm -f test/user.*
# /etc/init.d/mysqld start
# mysql mysql --password=hello
> select * from user;

Whew! success. This relies on the fact that by default, under RedHat at
least, there's a table called 'test' which everybody has access to without
a password. I suppose this is something to consider if you need a bit more
security.  Some would argue "once you've got root what else is there?".

 -- 
---<GRiP>--- 
Grant Parnell - senior consultant
EverythingLinux services - the consultant's backup & tech support.
Web: http://www.everythinglinux.com.au/services      
We're also busybits.com.au and linuxhelp.com.au.
Phone 02 8752 6622 to book service or discuss your needs.

-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to