MySql not accessible by root user

8,165

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

Share:
8,165

Related videos on Youtube

stdcerr
Author by

stdcerr

Coding mostly on embedded systems (24/7/365 uptime) to make a living at daytime, coding on a variety of systems (x86, arm) for fun at nighttime, preferences: Linux, C & C++. Always interested in learning other ways/better ways to solve problems!

Updated on September 18, 2022

Comments

  • stdcerr
    stdcerr over 1 year

    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
    owners.
    
    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?

    edit

    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)'