Article directory
Preface
The simple operability of the Pagoda Panel reduces the difficulty of operation and maintenance, and simplifies the tedious configuration of the Linux command line. In the following simple steps, you can quickly build a MySQL database service and achieve remote access to the public network through the Pagoda Panel + cpolar.
1.Mysql service installation
We open the Pagoda panel, click on the database, and then click to install the mysql service,
Just choose quick installation, the version is default
Then wait for the installation to complete
2.Create database
After installation, change the root password. This root password is also the password entered when logging in to mysql.
After the modification, we test adding a database. The Pagoda panel allows you to create a mysql database directly on the page, set the user name and password, set the access permission to everyone, and then submit it.
After the submission is successful, we can see that a database appears in the list.
Then we open a port 3306 on the Pagoda panel security page
3.Install cpolar
Open the Pagoda Terminal command window and use the cpolar installation script:
curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash
token authentication
Log in to the cpolar official website www.cpolar.com , click on the left 验证
to view your authentication token, and then paste the token into the command line
cpolar authtoken xxxxxxx
Add services to the system
sudo systemctl enable cpolar
Start cpolar service
sudo systemctl start cpolar
Select security in the Pagoda panel. Then open port 9200
Then the cpolar management interface will appear on the LAN ip+:9200 port, and then use the account registered on the official website to log in. If you have not registered, you can click the account below to register for free.
3.2 Create HTTP tunnel
Click Tunnel Management on the left dashboard - Create Tunnel. Since the default port in mysql is 3306, we need to create a tcp tunnel pointing to port 3306:
- Tunnel name: Customizable, be careful not to repeat it
- Protocol: tcp
- Local address: 3306
- Domain name type: Choose a random domain name
- Region: Select China VIP
Click创建
After the creation is successful, open the online tunnel list and view the public network tcp address.
4.Remote connection
Next, we use the database connection tool navicat to test the connection. The address uses the public network address above. Clicking on the test connection indicates success.
5. Fixed TCP address
Since the tunnel created above is a random address tunnel, the address will change within 24 hours. In order to make the connection more stable, a fixed TCP address is required.
It should be noted that configuring a fixed TCP port address requires upgrading cpolar to the Professional Edition package or above.
5.1 Reserve a fixed public network TCP port address
Log in to the cpolar official website backend, click Reserve on the left, and select the reserved TCP address.
- Region: Select China VIP
- Description: Notes, which can be customized
Click to keep
After the address is successfully reserved, the system will generate the corresponding fixed public address and copy it.
5.2 Configure fixed public network TCP port address
Log in to the cpolar web ui management interface again, click Tunnel Management >> Tunnel List on the left dashboard, find the mysql tunnel created above, and click Edit on the right.
Modify the tunnel information and configure the successfully reserved fixed TCP address into the tunnel.
- Port type: modified to fixed tcp port
- Reserved tcp address: fill in the successfully reserved address
Click to update
After the tunnel is updated successfully, click the status online tunnel list on the left dashboard to find the tunnel that needs to be edited. You can see that the public network address has been updated to a fixed TCP address.
Open the database connection tool again and use our fixed tcp address to connect to achieve remote connection.