CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2024
    Posts
    4

    another Access denied for user 'root'@'localhost' (using password: NO)

    in one terminal:
    sudo mariadbd --user=root --feedback=ON

    in another terminal:
    sudo mariadb
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    several threads about Access denied for user 'root'@'localhost' , said --user=root, would fix error.
    maybe there is info that was not included, that is assumed everyone knows.

    mysql server is running, sudo find / -type s , shows mysql is running

    i have even uninstalled and reinstalled.

    found some that said use:
    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';

    but seems to only be recognized, but not change error, with mysql client, but can not get mariadb client to start.

    Access denied for user 'root'@'localhost' , occurs from more than one place.

    --------------- edit ----------
    tried:
    sudo mysqlcheck --auto-repair --all-databases -p
    got
    mysqlcheck: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect

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

    --------------- edit ----------
    tried:
    sudo mysqlcheck --auto-repair --all-databases
    got
    mysqlcheck: Got error: 1045: Access denied for user 'root'@'localhost' (using password: NO) when trying to connect

    --------------- edit ----------
    tried
    mysql -uroot
    got
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    --------------- edit ----------
    i am guessing
    update user set authentication_string=password('my_password') where user='root';
    should be in mysql client, not on command line, because it gives
    bash: syntax error near unexpected token `('

    and gives:
    ERROR 1356 (HY000): View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
    when in client

    --------------- edit ----------
    $ sudo systemctl stop mysql
    $ sudo mkdir -p /var/run/mysqld
    $ sudo chown mysql:mysql /var/run/mysqld
    $ sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &
    [1] 3554
    $ /usr/sbin/mysqld: Please consult the Knowledge Base to find out how to run mysqld as root!
    2024-02-04 16:40:10 0 [ERROR] Aborting

    [1]+ Exit 1 sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking

    $ sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &
    should be
    $ sudo /usr/sbin/mysqld --user=root --skip-grant-tables --skip-networking &

    well, at least the server starts

    --------------- edit ----------
    client started
    mysql -u root
    > FLUSH PRIVILEGES;
    > USE mysql;

    syntex error with
    > ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';

    --------------- edit ----------

    had issue with:
    $ sudo /usr/sbin/mysqld --user=root --skip-grant-tables --skip-networking &
    but got
    $ sudo mariadbd --user=root --skip-grant-tables --skip-networking
    to work

    $ sudo mysql
    > FLUSH PRIVILEGES;
    > USE mysql;
    > ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password USING 'root';
    ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'localhost'
    > ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password AS 'root';
    ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'localhost'
    > exit

    [note: maybe not using $ sudo mysql -u root, was an error]

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

    --------------- edit ----------
    trying to use https://www.mysqltutorial.org/gettin...-mysql-ubuntu/,
    ALTER USER root@localhost aint working.
    trying to start server, complaints about files occur, delete the file, another complaint, give time, do something else, and it starts.

    using $ sudo mysql -u root does samething as $ sudo mysql

    --------------- edit ----------
    MariaDB [mysql]> SELECT user, host, password, HEX(authentication_string) FROM mysql.user;
    +-------------+-----------+----------+----------------------------+
    | User | Host | Password | HEX(authentication_string) |
    +-------------+-----------+----------+----------------------------+
    | mariadb.sys | localhost | | |
    | root | localhost | invalid | 696E76616C6964 |
    | mysql | localhost | invalid | 696E76616C6964 |
    +-------------+-----------+----------+----------------------------+
    3 rows in set (0.001 sec)


    I find a lot that is suppose to work, be either I am doing something wrong, or the very common error ...

    --------------- edit ----------
    lol, i really did not expect it to sort of work:
    MariaDB [mysql]> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password USING 'invalid';
    Query OK, 0 rows affected (0.018 sec)

    i thought to goal was to change password.

    --------------- edit ----------
    well, I got the password removed, but can not change password.
    MariaDB [mysql]> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password USING '';
    Query OK, 0 rows affected (0.012 sec)


    .
    Last edited by micha_eleric; February 8th, 2024 at 07:43 PM.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,379

    Re: another Access denied for user 'root'@'localhost' (using password: NO)

    [moved from C++ (Non Visual C++ Issues) forum]
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured