Installation:

sudo apt update
sudo apt install mariadb-server
sudo systemctl status mariadb
Copy the code

Enable remote access:

Skip-networking enables remote access.
Bind-address allows all remote machine connections.
vi /etc/mysql/my.cnf
Grant remote access to the database.
use mysql;
GRANT ALL PRIVILEGES ON *.* TO 'root'@The '%' IDENTIFIED BY 'chaochao';
FLUSH PRIVILEGES;
service mysql restart
Copy the code

Let me make a note

Golang agent:

export GOPROXY=https://mirrors.aliyun.com/goproxy/
export GOPROXY=https://goproxy.cn
export GOPROXY=https://goproxy.io
Copy the code

Go Mod:

# Initialize the go mod
go mod init github.com/GoMod
Compile to download dependencies
go build main.go
View all dependencies under module
go list -m all
# Update stable version dependencies
go get rsc.io/sampler
# Clean up useless dependencies
go mod tidy
Copy the dependencies to the vendor folder of the project path
go mod vendor
# ignore the packages in the cache and only use the dependencies in the vendor directory to compile
go build -mod=vendor
Check dependencies and see if any changes have been made
go mod verify
Copy the code