linux - mySQL: "Access denied for user 'root'@'localhost" after installing the software -


i have installed mysql 5.1.55 on linux box, , seems ok

# /usr/local/mysql/bin/mysql_install_db installing mysql system tables... 160606 21:46:25 [warning] '--skip-locking' deprecated , removed in future release. please use '--skip-external-locking' instead. ok filling tables... 160606 21:46:26 [warning] '--skip-locking' deprecated , removed in future release. please use '--skip-external-locking' instead. ok  start mysqld @ boot time have copy support-files/mysql.server right place system  please remember set password mysql root user ! so, start server, issue following commands:  /usr/local/mysql-5.1.55/bin/mysqladmin -u root password 'new-password'  alternatively can run: /usr/local/mysql-5.1.55/bin/mysql_secure_installation  give option of removing test databases , anonymous user created default.  recommended production servers.  see manual more instructions.  can start mysql daemon with: cd /usr/local/mysql-5.1.55 ; /usr/local/mysql-5.1.55/bin/mysqld_safe &  can test mysql daemon mysql-test-run.pl cd /usr/local/mysql-5.1.55/mysql-test ; perl mysql-test-run.pl  please report problems /usr/local/mysql-5.1.55/bin/mysqlbug script! 

however, if run

# /usr/local/mysql-5.1.55/bin/mysqladmin -u root password foo 

i error message:

/usr/local/mysql-5.1.55/bin/mysqladmin: connect server @ 'localhost' failed error: 'access denied user 'root'@'localhost' (using password: no)' 

if run:

# /usr/local/mysql-5.1.55/bin/mysql -u root -p 

i not able figure out password :-s

any welcome. thank much.

if have installed mysql without running

> mysql_secure_installation 

script there should no password @ all. type

> mysql  

and see happens. if fails can still set new root password following mysql manual