Home>

Why does phpmyadmin give an error when logging in?# 1698 -Access denied for user 'root' @ 'localhost'... The installation was performed as follows:

sudo tasksel install lamp-server
sudo apt-get install phpmyadmin

Password assigned. OC Linux mint. Tried to enter in the consolemysql -u root -pAfter demanded to enter and again gave an error# 1698 -Access denied for user 'root' @ 'localhost'

why is this taskset why

Антон Веселов2021-09-27 03:26:35

@AntonVeselov -The tasksel command line utility allows using the menu system to select one or more groups of packages and install them on your Ubuntu system.

titov_andrei2021-09-27 08:00:11
  • Answer # 1

    ErrorAccess denied for user 'root' @ 'localhost'means that the root user with the password you specify does not have access to the DBMS.

    Apparently the password was not set or was set incorrectly, or instead of 'root' @ 'localhost' the user 'root'@127.0.0.1 was installed. Try typing in the console

    mysql -h 127.0.0.1 -u root -p
    

    If after that you are allowed into the DBMS, you need to create an additional user 'root' @ 'localhost'

    GRANT ALL ON *. * TO 'root' @ 'localhost'
    WITH GRANT OPTION
    IDENTIFIED BY 'password'
    

    If it doesn't, then you need to restore the root password. Find the configuration file my.cnf and add the directive to the [mysqld] sectionskip-grant-tableswhich will disable access rights checking

    [mysqld]
    ...
    skip-grant-tables
    

    Then restart the server. Now you can login MySQL without password, login and reset password

    SET PASSWORD FOR 'root' @ 'localhost'= PASSWORD ('new_password');
    

    After that, remove the directiveskip-grant-tablesfrom my.cnf and restart the server.

    It is also worth recalling that the skip grant table must be commented out after setting a new password.

    Naumov2021-09-27 03:26:35

    @Naumov, thanks, completed the answer.

    cheops2021-09-27 03:26:35

    SET PASSWORD FOR 'root' @ 'localhost'= PASSWORD ('root') MySQL response: Documentation # 1290 -The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

    Vasily Suricov2021-09-27 09:40:59

    Where can I find my.cnf config file in Ubuntu?

    nick2021-09-27 15:55:23

    You can focus on table 4.2 at dev.mysql.com/doc/refman/8.0/en/option-files.html MySQL will sequentially poll folders in the order in which they are listed in the table. The file that is found first will be used.

    cheops2021-09-27 15:55:23
  • Answer # 2

    You just need to enter:

    sudo mysql_secure_installation
    

    and answer questions then we log in:

    sudo mysql -h localhost -u root -p
    
  • Answer # 3

    in newer versions after MySQL 5.7.6, the password change command is slightly different:

    ALTER USER 'root' @ 'localhost' IDENTIFIED BY 'new_password';