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
(Figure: 001 Create MySQL ssh channel to allow remote services)
(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:
(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.
(Picture: 003 navicat operation demonstration)
After filling in the information, pay attention to click Test Connection
(Test machine connected successfully)
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
(It was successful as shown in the picture)
(navicat graphical operation interface)
(Command line view)
4.Navicat remote connection common error alarms
(Error 1)
Solution 1 is as follows:
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)
(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.
(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.)
(Click to start the service and select automatic)
(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:
- After the server logs in to mysql, change the "host" item in the "user" table in the "mysql" database from "localhost" to '%'.
- SQL statement: Authorized user root login: mysql -u root -p
- Select the mysql library: use mysql;
- 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';
- 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';
- Refresh MySQL’s system permissions related tables: flush privileges;
- 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.