create user
CREATE USER username IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%'IDENTIFIED BY 'password' WITH GRANT OPTION;
Notes:
File path /etc/mysql/mariadb.conf.d/50-server.cnf
bind-address = 127.0.0.1 ###This sentence means that only the local machine is allowed to access mysql
become like this
#bind-address=127.0.0.1
restart mysql: /etc/init.d/mysql restart
The remote link is successful, the firewall must open port 3306