Navicat remote connection to MySQL implementation steps analysis

Navicat remote connection to MySQL implementation steps analysis

Preface

I believe that everyone has been developing on a remote server, and the usage rate of MySQL should be quite high. It is a good choice to use visual tools such as Navicat to operate the remote database, avoiding the operation of writing SQL statements on the command line. The following is a brief introduction to the operation of Navicat connecting to a remote database.

1

First, we need to change port 3306 and check whether it is open to the outside world. By default, MySQL does not allow external access. The statement is as follows:

netstat -an | grep 3306

If the query results are as follows, we need to change the MySQL configuration file.

It can be seen that the MySQL port 3306 only listens to local connections, which prevents external IP from accessing the database. Modify the MySQL configuration file my.conf:

vim /etc/mysql/my.cnf

turn up

# 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

Comment out the line bind-address = 127.0.0.1 or change it to the client host ip you want to use.

At this point, the MySQL remote access port has been successfully opened.

2

We enter the MySQL command interface and run the following SQL statement to check whether the user has access rights:

use mysql;
select user, host from user;

The returned results are as follows:

We use the wildcard % to modify the host field corresponding to the root user so that he has access to all IP addresses:

update user set host = '%' where user = 'root';

If the following exception is thrown:

Duplicate entry '%-root' for key 'PRIMARY'

This indicates that there are multiple ROOT user records in the USER table. Let's re-execute:

select host from user where user = 'root';

You can see the % value of the host field.

We perform:

flush privileges;

Refresh the MySQL system privilege related tables.

Finally, restart the MySQL service:

sudo restart mysql

3

The server is set up, let's set up the connection in the Navicat client:

Open Navicat, click "Connect" in the upper left corner, set the database username, address, password, etc., and you can remotely operate MySQL on the server in Navicat.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • When Navicat Premium connects to the database, the error message appears: 2003 Can't connect to MySQL server on''localhost''(10061)
  • How to solve the 10060 unknow error when Navicat remotely connects to MySQL
  • Solve the problem that Navicat cannot connect to MySQL on the Linux server
  • Solve the 1251 error when establishing a connection between mysql and navicat
  • Detailed explanation of the idea of ​​installing mysql8.0.11 and changing the root password and connecting navicat for mysql
  • Solution to 1045 error when navicat connects to mysql
  • About the problem of Navicat connecting to MySql database slowly

<<:  SELinux Getting Started

>>:  Implement full screen and monitor exit full screen in Vue

Recommend

Web skills: Multiple IE versions coexistence solution IETester

My recommendation Solution for coexistence of mul...

Detailed steps to download Tomcat and put it on Linux

If you have just come into contact with Linux, th...

Nginx configuration location matching rules example explanation

The scope of nginx configuration instructions can...

Nginx uses reverse proxy to implement load balancing process analysis

Introduction Based on docker container and docker...

CSS easily implements fixed-ratio block-level containers

When designing H5 layout, you will usually encoun...

How to use CSS3 to implement a queue animation similar to online live broadcast

A friend in the group asked a question before, th...

Application and implementation of data cache mechanism for small programs

Mini Program Data Cache Related Knowledge Data ca...

Special commands in MySql database query

First: Installation of MySQL Download the MySQL s...

Let's talk about the characteristics and isolation levels of MySQL transactions

The Internet is already saturated with articles o...

Realizing provincial and municipal linkage effects based on JavaScript

This article shares the specific code of JavaScri...

In-depth understanding of this in JavaScript

In-depth understanding of this in Js JavaScript s...

Vue implements table paging function

This article example shares the specific code of ...

MySQL Series Database Design Three Paradigm Tutorial Examples

Table of contents 1. Knowledge description of the...