1、错误
grant all privileges on zabbix.* to zabbix@localhost identified by 'Kklinowo2020#@!!!';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by 'Kklinowo2020#@!!!'' at line 1
mysql>
2、原因
MySQL 8.0新版本已经将创建用户、用户赋权的方式分开了。
3、解决方法创建用户:create user ‘用户名’@’访问主机’ identified by ‘密码’;
用户赋权:grant 权限列表 on 数据库 to ‘用户名’@’访问主机’ ;(修改权限时在后面加with grant option)
实例:
mysql> create user 'zabbix'@'localhost' identified by 'Kklinowo2020#@!!!';
Query OK, 0 rows affected (0.01 sec)
mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)