Teach you step by step to configure MySQL remote access

Teach you step by step to configure MySQL remote access

Preface

When using the MySQL database, sometimes the client needs to log in to the server's database directly remotely instead of sending the request to the database server. At this time, you need to configure the remote access permissions of MySQL. The specific configuration method is also very simple. You can find a lot of tutorials on how to configure remote login to the MySQL database by searching any search engine.

step

The steps introduced online are basically divided into two steps:

Modify the my.cnf configuration file

The mysql configuration file is usually in /etc/mysql/my.cnf. Open it to view its configuration. There is such a section:

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1

This bind-address is to bind the IP, which means that only the local machine is allowed to log in by default. In order to achieve remote login, this sentence obviously needs to be commented out. After modification, restart the mysql service.

Add User Permissions

As needed, set the corresponding permissions for the specified user and IP

mysql>GRANT ALL PRIVILEGES ON AB TO 'user'@'%'IDENTIFIED BY 'password' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES

Here, all permissions on table B in database A are granted to the user from any host ('%') who logs in with password 'password'.

Or directly modify the user table in the MySQL database to meet the requirements.

The above is what you need to do in theory, but I did it and still couldn't connect. After a lot of trouble, I finally found out that the server provider had imposed additional restrictions on the opening of ports in order to ensure the security of the server. For example, Tencent server sets up a security group, which additionally restricts the open ports. By default, the MySQL port 3306 is prohibited from being opened. Therefore, you need to open the console and configure the permissions:

The rest are default, just add the second to last line. . .

Summarize

The above is the full content of this article. I hope that the content of this article can bring some help to your study or work. If you have any questions, you can leave a message to communicate. Thank you for your support of 123WORDPRESS.COM.

You may also be interested in:
  • The Ultimate Method for MySQL Remote Access Settings
  • Summary of how to set remote access permissions for MySQL database
  • How to set up remote access to mysql database
  • mysql set up a specified ip remote access connection instance
  • How to enable remote access rights for MySQL database (two methods)
  • Multiple methods of setting up remote access to the mysql database
  • Disable MySQL domain name resolution (to solve the problem of slow remote access to MySQL)
  • Two ways to solve the problem of remote access to mysql
  • Solution to MySQL not allowing remote access
  • Summary of methods for remote access to MySQL database

<<:  js to call the network camera and handle common errors

>>:  Detailed explanation of docker entrypoint file

Recommend

URL representation in HTML web pages

In HTML, common URLs are represented in a variety ...

Analysis of MySQL data backup and recovery implementation methods

This article uses examples to describe how to bac...

How to add double quotes in HTML title

<a href="https://www.jb51.net/" titl...

CSS to achieve floating customer service effect

<div class="sideBar"> <div>...

TypeScript installation and use and basic data types

The first step is to install TypeScript globally ...

Nginx solves cross-domain issues and embeds third-party pages

Table of contents Preface difficulty Cross-domain...

How to operate MySql database with gorm

1. Setting case sensitivity of fields in the tabl...

Vue implements card flip carousel display

Vue card flip carousel display, while switching d...

mysql5.7.18.zip Installation-free version configuration tutorial (windows)

This is the installation tutorial of mysql5.7.18....

Realize breadcrumb function based on vue-router's matched

This article mainly introduces the breadcrumb fun...

Detailed explanation of routes configuration of Vue-Router

Table of contents introduce Object attributes in ...

Detailed explanation of three ways to wrap text in el-table header

Table of contents Problem Description Rendering T...