Try to login without a password, so as username root and leave the password field empty
QLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'
Hi,
I'm getting an SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' message when I try to login to my Laravel project user login dashboard.
Interestingly, I'm unable to access my phpMyAdmin http://localhost/phpMyAdmin/index.php even though I didn't change the password. I normally login with root as my username and my password is simply 'password'. I use OpenSuse Leap 15.5 (a Linux distro). I'm unable to reset the password. I did check the status of MySQL in the terminal by typing 'sudo systemctl status mariadb.service' and it's showing as active.
Grateful for your guidance.
@gych I tried and it says: mysqli::real_connect(): (HY000/1698): Access denied for user 'root'@'localhost'
Login without a password is forbidden by configuration (see AllowNoPassword)
In the Linux terminal, I typed this: sudo systemctl stop mysql and then this: sudo mysqld_safe --skip-grant-tables & and I was able to enter myPHPAdmin panel.
I typed this in the SQL tab: SET PASSWORD FOR 'root'@'localhost' = PASSWORD('developer'); and clicked on the Go button and got this message: Error SQL query: Copy SET PASSWORD FOR 'root'@'localhost' = PASSWORD('developer'); MySQL said: Documentation #1290 - The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
In the General settings I tried to change the password and got this message: SQL query: Copy
SET password = PASSWORD('***') MySQL said: Documentation
#1290 - The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
I tried to restart mySQL by typing sudo systemctl start mysql and the sudo systemctl status mariadb.service to check the status to see if it's running and it says:
mamunsson@dynamic-pd01:> sudo systemctl start mysql [sudo] password for root: Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xeu mariadb.service" for details. mamunsson@dynamic-pd01:> sudo systemctl status mariadb.service × mariadb.service - MariaDB database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sun 2024-04-07 11:40:25 CEST; 8s ago Docs: man:mysqld(8) https://mariadb.com/kb/en/library/systemd/ Process: 13987 ExecStartPre=/usr/lib/mysql/mysql-systemd-helper install (code=exited, status=0/SUCCESS) Process: 13993 ExecStartPre=/usr/lib/mysql/mysql-systemd-helper upgrade (code=exited, status=0/SUCCESS) Process: 13999 ExecStart=/usr/lib/mysql/mysql-systemd-helper start (code=exited, status=1/FAILURE) Main PID: 13999 (code=exited, status=1/FAILURE) Status: "MariaDB server is down"
Apr 07 11:39:55 dynamic-pd01.res.v6.highway.a1.net systemd[1]: Starting MariaDB database server... Apr 07 11:40:25 dynamic-pd01.res.v6.highway.a1.net systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE Apr 07 11:40:25 dynamic-pd01.res.v6.highway.a1.net systemd[1]: mariadb.service: Failed with result 'exit-code'. Apr 07 11:40:25 dynamic-pd01.res.v6.highway.a1.net systemd[1]: Failed to start MariaDB database server. mamunsson@dynamic-pd01:~> ^C
Have you tried to follow this guide to reset the password?
https://dev.mysql.com/doc/refman/8.3/en/resetting-permissions.html
Scroll a bit down for Linux instructions
I see a var/lib/mysql and var/lib/mysql-files but I can't access them. I tried to access them as super user by typing sudo su and then I navigate to cd /var/lib/mysql-files or cd /var/lib/mysql
I came across this link: https://stackoverflow.com/questions/36864206/sqlstatehy000-1698-access-denied-for-user-rootlocalhost and tried this:
"In short, in MariaDB:
sudo mysql -u root; use mysql; UPDATE mysql.user SET plugin = 'mysql_native_password', Password = PASSWORD('pass1234') WHERE User = 'root'; FLUSH PRIVILEGES; exit;"
But I'm still unable to access phpMyAdmin.
Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 23 Server version: 10.6.15-MariaDB MariaDB package
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
Database changed MariaDB [mysql]> UPDATE mysql.user SET plugin = 'mysql_native_password', Password = PASSWORD('pass1234') WHERE User = 'root'; 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 MariaDB [mysql]> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.001 sec)
Ok, I was able to successfully change the password by typing it like this in the terminal: sudo mysqladmin -u root password 'developer'
@Mamunsson Ok nice that you manages to solve it :)
Please or to participate in this conversation.