I installed Lamp server in my ubuntu jaunty.When I first tried access to mysql database with root,I got an error:
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)
The password for root by default is null,so we need to reset the password.

Use this command in terminal:

sudo cat /etc/mysql/debian.cnf

We can use the user and password in output to access database,and then reset root password:

# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = IKORmdRRYQ9JHwtx
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
user     = debian-sys-maint
password = IKORmdRRYQ9JHwtx
socket   = /var/run/mysqld/mysqld.sock
basedir  = /usr