Home  >  Article  >  System Tutorial  >  Solve the problems encountered by Idea in Ubuntu 18.04 when operating the database

Solve the problems encountered by Idea in Ubuntu 18.04 when operating the database

PHPz
PHPzforward
2023-12-27 20:35:12726browse

Like the title, record the steps to solve a failure: The idea failed to operate the database in linux (ubuntu 18.04), and the error message was: Client does not support authentication protocol requested by server; consider upgrading MySQL client. Because I am also a novice, there are some concepts in it It is based on my understanding. If there are any mistakes, please correct me!!!

Possible reasons: Insufficient permissions

I found that when I enter mysql in the terminal, I need root permission every time. Otherwise, "Access denied for user 'root'@'localhost'" will be the same even in navicat. Ordinary users cannot connect at all. It reports a 2002 error. But if I am the root user, there is no problem logging in. It’s very confusing!
So I suspect it is because my idea does not have root permissions. After all, I opened the idea with ordinary user permissions.
Attached is the terminal login mysql method (root can be replaced with other user names)

via :~$ mysql -u root -p

Approximate solution: Create a new ordinary user. This user has all permissions to add, delete, modify and check. Use this username and password to log in in idea. It works!! Detailed operation Use root permissions to enter mysql

via :~$ sudo su
via :~$ mysql -u root -p

increase user

CREATE USER '用户名'@'host' IDENTIFIED BY '密码';

Authorization (I grant all permissions, so it is ALL, please modify it depending on the situation)

GRANT ALL ON *.* TO '用户名'@'localhost';

refresh

flush privileges;

The above is the detailed content of Solve the problems encountered by Idea in Ubuntu 18.04 when operating the database. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete