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

In-depth understanding of the use of Vue

Table of contents Understand the core concept of ...

How to delete the container created in Docker

How to delete the container created in Docker 1. ...

How to change the terminal to a beautiful command line prompt in Ubuntu 18

I reinstalled VMware and Ubuntu, but the command ...

JavaScript removes unnecessary properties of an object

Table of contents Example Method 1: delete Method...

25 fresh useful icon sets for download abroad

1. E-Commerce Icons 2. Icon Sweets 2 3. Mobile Ph...

MySQL5.7 master-slave configuration example analysis

MySQL5.7 master-slave configuration implementatio...

Share 8 MySQL pitfalls that you have to mention

MySQL is easy to install, fast and has rich funct...

Troubleshooting of master-slave delay issues when upgrading MySQL 5.6 to 5.7

Recently, when upgrading the Zabbix database from...

Vue implements time countdown function

This article example shares the specific code of ...

Mysql practical exercises simple library management system

Table of contents 1. Sorting function 2. Prepare ...

The difference and usage between div and span

Table of contents 1. Differences and characterist...

Explanation of the problem that JavaScript strict mode does not support octal

Regarding the issue that JavaScript strict mode d...

Implementation of form submission in html

Form submission code 1. Source code analysis <...

Notes on matching MySql 8.0 and corresponding driver packages

MySql 8.0 corresponding driver package matching A...

Linux uses bond to implement dual network cards to bind a single IP sample code

In order to provide high availability of the netw...