How can I access mysql on lamp droplet?

February 25, 2014 1.5k views
I've ssh onto server. Then tried to use mysqladmin -u root -p 'password' to access mysql, but that doesn't work. How can I add a user to mysql? which command should I use?
4 Answers
mysql -u root -p
Enter your password

CREATE USER 'username'@'host' IDENTIFIED BY 'password';
I tried it, but here is what I get:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Did you restart MySQL and set a password yet? Restart the mysql service and set a pass for MYSQL root, use that pass for mysql.
I didn't install mysql myself. I use the Lamp image when I create the Droplet.
After I login to server, actually I can't do anything on Mysql.

Especially, I was told this every time I logged in:
Please be sure to change your root MySQL password; current MySQL password is "password"

You can change the MySQL password with the following command:

mysqladmin -u root -p'password' password newpassword

But I still can not access Mysql using the command it gives me: mysqladmin -u root -p'password' password newpassword

Do you have any idea?
Have another answer? Share your knowledge.