Error: connect ETIMEDOUT
应该是mariadb默认只允许本地连接,修改 /etc/mysql/mariadb.conf.d/50-server.cnf 文件
然后将 bind-address 127.0.0.1 改成 0.0.0.0 然后重启mysql
Error: ER_HOST_NOT_PRIVILEGED: Host ‘xxx’ is not allowed to connect to this MariaDB server
这种是你登录的用户只允许本地连接
USE mysql;
SELECT user,host FROM user;
// 这样可以看到你的用户和权限,把localhost改成你的ip或者改成 % 允许所有ip登录
GRANT ALL PRIVILEGES ON *.* TO username@'%' IDENTIFIED BY 'passwd' WITH GRANT OPTION;
上面该权限的代码要注意 用户名 不用加单引号,%要加,密码要加