MySQL remote login prompts Access denied scenario

A certain MySQL library provided by the manufacturer prompts this error when logging in remotely through the client.

Access denied for user '用户名'@'IP' (using password: YES)

Confirm that the account and password entered are correct. If this error occurs, it means that the port is open.

At this time, you can retrieve mysql.user. If the host field of the record of the account to be logged in is localhost, it means that only local login is allowed and remote login is prohibited.

[mysql]> select user, host from user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| test             | localhost |
+------------------+-----------+

You need to change the test user's host to %, which means you can log in remotely from any network IP.

This is one possibility. Another possibility is that this account has not been granted access to the table. It needs to be authorized separately, which can be executed through the following statement:

grant all privileges on bisal.* to 'test'@'%';

In addition, if you use MySQL 8.0 or above, you may get an error if you use grant directly.

You are not allowed to create a user with GRANT

Because this version does not support user creation during authorization, you must create it before you can authorize it.

create user test@'%' identified by 'test';
grant all on test.* to 'test'@'%';

If you think this article is helpful, please feel free to click "Like" and "Reading" at the end of the article, or forward it directly to pyq,

541aa95e94c9e843a261b985bd3fd6b3.png

Recently updated articles:

" Usage scenarios of JDBC connection parameter useCursorFetch "

" Scenarios of Index Creation Error in MySQL "

" MySQL character set conversion operation scenario "

" Financial Knowledge - Secondary Market "

" Introduction to the poweroff command "

Recent hot articles:

" Recommend a classic paper on Oracle RAC Cache Fusion "

" The shock that the open source code of the "Red Alert" game brings to us "

Article classification and indexing:

Classification and indexing of 1,300 articles on public accounts

Guess you like

Origin blog.csdn.net/bisal/article/details/133152822