0

I have this error in gitlab CI console.

SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema = <mydatabase> and table_name = migrations and table_type = 'BASE TABLE')

after searching, I have already tried

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mypassword';

someone can help me please ? I use debian production server !

Sacha Durand
  • 473
  • 1
  • 5
  • 11
  • You can follow this instruction https://stackoverflow.com/questions/57567218/cant-login-to-mysql-server/57567533#57567533 – A.A Noman Aug 26 '21 at 12:47
  • thanks a lot ! my problem is solved ! it was a problem of .env variable and I think of the cache as well – Sacha Durand Aug 27 '21 at 13:30

1 Answers1

1

In the new my-sql if the password is left empty while installing then it is based on the auth_socket plugin.

The correct way is to login to my-sql with sudo privilege.

$ sudo mysql -u root -p

if you are using the MAMP in macOS then the version of MAMP you're using installs itself in /Applications/MAMP. First make sure via the MAMP console that the Mysql server is on. Then connect like this from command line:

/Applications/MAMP/Library/bin/mysql -uUsername -pPassword

Enter your database password and then updating the password using:

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new-password';

where new-password is your new database password or what you want

then type the following the command in my-sql terminal:

mysql> FLUSH PRIVILEGES;

By trying this i hoped your issue will be solved if not then do comments Thank you

  • Hi @Junaid, I am still facing same issue, it was working fine when I am running php7.4 but when I chaged 5.6 version then this is showing this error. – shiva chauhan Jun 09 '22 at 16:01