有两种解决方法:

1.授权法

GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION; // %:表示从任何主机连接到mysql服务器

FLUSH PRIVILEGES;

 

或者

GRANT ALL PRIVILEGES ON *.* TO 'user'@'192.168.1.5' IDENTIFIED BY 'password' WITH GRANT OPTION;//表示从指定ip从任何主机连接到mysql服务器

FLUSH PRIVILEGES;

连接错误:Host xxx is not allowed to connect to this MariaDb server_解决方法

 

错误:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

在[mysqld]下添加skip-grant-tables,保存即可。