I have a local MySql server. It is started as I can access it with my local user like

$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 66
Server version: 5.5.34-0ubuntu0.13.04.1 (Ubuntu)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit

just fine but when i try with root, I keep getting this:

$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

What does this mean and how can I fix this?


Also this doesn't work (after running sudo mysql_install_db ):

$ /usr/bin/mysqladmin -u root password 'MyPass'
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'

Try using

mysql -u root -p

for a password prompt.

If that does not work then perhaps refer to https://stackoverflow.com/questions/11760177/access-denied-for-root-user-in-mysql-command-line

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.