Home > Database > Mysql Tutorial > body text

How to enable remote login permissions for users in MySQL

WBOY
Release: 2023-05-31 14:43:06
forward
11828 people have browsed it

MySQL enables user remote login permissions

After creating a Mysql container in Docker, you need to use tools such as: navicate to connect to the MySQL service in the container, but

prompts Access denied for user 'root'@ 'x.x.x.x' (using password: YES) error. If there is no problem with entering the container using the command to confirm the password, then it may be that there is no development remote permission.

The first step: select the mysql database

use mysql;
Copy after login

The second step: modify the user table in the library, the user user's host=% (any connection)

update user set host='%' where user ='root';
Copy after login

The third step Step: Reload the permission table

flush privileges;
Copy after login

Step 4: Grant remote connection permissions to the root user

grant all privileges on *.* to 'root'@'%' with grant option;
# 赋予权限并修改密码
alter user 'root'@'%' identified with mysql_native_password by '123456';
Copy after login

Open remote access permissions for MySQL

1. Use mysql -u root -p Connect to the local MySQL service

2. After logging in, use use mysql;

3. Use grant all privileges on . to ‘root’@‘%’ identified by ‘ 123456’ with grant option; Grant remote login user permissions (use root account and password 123456, connect to mysql server from any host), refresh permissions FLUSH PRIVILEGES;

4. Use select user,host from user to view the system User

5. Use vim /etc/mysql/mysql.conf.d/mysqld.cnf to modify the access URL of bind-address, and change bind-address=127.0.0.1 to bind-address=0.0.0.0

6. Open port 3306 (this is the default port of MySQL)

The above is the detailed content of How to enable remote login permissions for users in MySQL. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template