Home > Database > Mysql Tutorial > Mysql database sets remote connection permissions

Mysql database sets remote connection permissions

藏色散人
Release: 2019-02-16 17:56:08
forward
3400 people have browsed it

Problem phenomenon

Mysql is installed and the local login is normal. When entering the correct account and password remotely to log in, the error is as follows

Mysql database sets remote connection permissions

Cause of the problem

The remote IP does not have login permission. By default, the root user can only log in on localhost, that is, on this machine. You need to set up to allow other IPs to log in. permissions.

Solution

1. Log in to the database inside the server, and then execute

grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
Copy after login

This statement means to the root user You can log in to the database from any IP and operate any object in any database.

Among them:

*.* The first * refers to the database

* represents all databases

The second * refers to the database object

*Represents all objects in the database

'root'@'%' root is the database user to be authorized

% represents the IP allowed to log in

123456 is Your database password

If you want to restrict login to 1.1.1.1, change % to 1.1.1.1. After execution, execute flush privileges; refresh permissions

Mysql database sets remote connection permissions

2. Then the mysql client on the remote computer can be connected.

Mysql database sets remote connection permissions

Mysql database sets remote connection permissions

Related recommendations: "mysql tutorial"http ://www.php.cn/course/list/51.html

The above is the detailed content of Mysql database sets remote connection permissions. For more information, please follow other related articles on the PHP Chinese website!

source:aliyun.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