How to remotely connect Navicat to the cloud server database (including error resolution)

 

Table of contents

 1. Start the SSH service on the server console

 2. Steps for navicat to remotely connect to the cloud server database:

3.navicat operation demonstration

4.Navicat remote connection common error alarms


 

 

 1. Start the SSH service on the server console

192ec342841342608baa4dac31f2e3dc.png

(Figure: 001 Create MySQL ssh channel to allow remote services) 

4de7c7232989468ba51175b5c67d2cfd.png

 

 (First log in to the backend management console officially provided by the cloud server. Here, Tencent Cloud Server is used as a demonstration)

 1. Click Firewall

2. Click Add Rule

3. Allow access, OK

The final creation result is shown in Figure 001 above.

 2. Steps for navicat to remotely connect to the cloud server database:

 5aefbd9823314ed892561a87f5e68e13.png

 (Picture: 002 navicat operation demonstration - SSH)

 Note that if the password and user name of the server have not been changed, they will be the user name and password of the server you just purchased. If you forget them, you can log in to the official website of the cloud server to reset the password.

 

fffd9817974a4664aaec93a6badaea65.png

(Picture: 003 navicat operation demonstration) 

 After filling in the information, pay attention to click Test Connection

a562c8a0a04743b3ae2a31c3921be046.png

 (Test machine connected successfully)

75a517b18fef4f04bf299a4469dd60d5.png

 

After the connection is successful, click OK. If a message pops up later: asking for an SSH key, just enter the server password directly.​ 

3.navicat operation demonstration

cf930ca42b394d18be52e1aed31b4d9c.png

 (It was successful as shown in the picture)

36700ca74e1e446e8b863c0df9a67eb0.png

(navicat graphical operation interface) 

536de428bba041a3819847ac4882de25.png

(Command line view) 

4.Navicat remote connection common error alarms

7cc9e7a8158f404ea7aaf0d9d5399512.png

(Error 1) 

Solution 1 is as follows:

a6a342172f594f36820bafbab0a8042f.png

Enter the command: sudo nano /etc/ssh/sshd_config

Enter the server's ssh editor and enable it: PermitRootLogin yes

 (Clothing equipment opening:PermitRootLogin yes)

7e430c0dfd5442bca970e0808a5f0d78.png

(After entering, the Linux server operation command ctal + o means: enter the editing interface; CATL + x exit editing; enter yes to save and exit)

 

If it still doesn't work, it's probably because the username and password are wrong. If it says yes, it means the username and password are wrong.

 

Reason for the error: The user name and password at position 002 in the above picture are incorrect, or the database name and password at position 003 in the above picture are incorrect.

Solution 2: Reconfirm the password and username and enter them again.

 

5d6a009f1215437896de3e2dcdb0b71d.png

 (Error 2)

Find the icon on the desktop, right-click "Manage" -> Enter "Services and Applications" -> Double-click to open "Services" -> Find "MYSQL" (the name can be MySQL80, MySQL5, etc., according to the version you have installed to make sure.)

79b0fc9d6d62440283066c9b80632c4b.png (Click to start the service and select automatic)

 

729b449fd0c34549bcbf8411faceae16.png

(Error 3) 

Error: 1130

Solution: At 001 in the picture above, enter the official backend management website of the cloud server and open the SSH channel with MYSQL.

If this still can't be solved

    Please do the following:

 

It may be a problem of not being able to give the remote connection user permissions.

    solution:

  1. After the server logs in to mysql, change the "host" item in the "user" table in the "mysql" database from "localhost" to '%'.
  2. SQL statement: Authorized user root login: mysql -u root -p  
  3. Select the mysql library: use mysql;  
  4. View the host value of the user table in the mysql library (that is, the host/IP name for connection access): select host from user where user='root';  
  5. Modify the host value (add the host/IP address with the content of wildcard %). Of course, you can also directly add the IP address: update user set host = '%' where user ='root';  
  6. Refresh MySQL’s system permissions related tables: flush privileges;  
  7. Re-query whether the host field value has changed: select host from user where user='root';\n\nservice mysqld restart (executed after quit; exits MySQL) and restart the mysql service to complete.

Demo code:

>mysql -u root -p(后跟数据库密码)

>use mysql

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

>select host,user from user;

>flush privileges;

 

If you have any other questions, please leave a message~,

Hope this helps you who are reading.

 

Guess you like

Origin blog.csdn.net/m0_48565215/article/details/128376030