Setting the root mysql password

nodata fedora at nodata.co.uk
Thu Apr 21 22:15:29 UTC 2005


On Thu, 2005-04-21 at 23:01 +0100, Paul F. Johnson wrote:
> Hi,
> 
> I'm trying to set the root password for mysql using
> 
> mysqladmin -u root password <new_pass>
> 
> but all I'm getting back is 
> 
> mysqladmin: connect to server at 'localhost' failed
> error: 'Access denied for user 'root'@'localhost' (using password: NO)'
> 
> mysqld is running
> 
> /etc/hosts has the following
> 
> 127.0.0.1   localhost.localdomain T7.linux localhost T7
> 
> Any ideas?
> 
> Using fc4t2, mysql-4.1.11-2
> 
> TTFN
> 
> Paul
> -- 
> "In an urban society, everything connects. Each person's needs are fed
> by the skills of many others. Our lives are woven together in a fabric.
> But the connections that make society strong also make it vulnerable." -
> Threads, BBC-TV 1984
> 

You probably want to specify a null password, i.e. -p at the end.

I do it this way:

# mysql -u root -p
> USE mysql; 
> UPDATE user SET Password=PASSWORD("something") WHERE User="root";
> FLUSH PRIVILEGES;

Your hosts file also looks a bit messy. MySQL and other programs (wrongfully) get confused.
Try:
127.0.0.1	localhost localhost.localdomain
my.ip.goes.here	myhostname

Good luck!




More information about the test mailing list