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

...

Docker Detailed Illustrations

1. Introduction to Docker 1.1 Virtualization 1.1....

The process of using vxe-table to make editable tables in vue

There is a table in the project that needs to be ...

Detailed explanation of mysql basic operation statement commands

1. Connect to MySQL Format: mysql -h host address...

Example of compiling LNMP in Docker container

Table of contents 1. Project Description 2. Nginx...

Summary and examples of vue3 component communication methods

The communication modes of vue3 components are as...

Linux kernel device driver character device driver notes

/******************** * Character device driver**...

Detailed explanation of Linux zabbix agent deployment and configuration methods

1. Install zabbix-agent on web01 Deploy zabbix wa...

CSS flex several multi-column layout

Basic three-column layout .container{ display: fl...

Detailed explanation of the role and principle of key in Vue

Table of contents 1. Let’s start with the conclus...

JavaScript to achieve full screen page scrolling effect

After I finished reading JavaScript DOM, I had a ...

Limiting the number of short-term accesses to a certain IP based on Nginx

How to set a limit on the number of visits to a c...

Summary on Positioning in CSS

There are four types of positioning in CSS, which...