创建数据库后配置用户报错如下
grant all privileges on wordpress.* to wp@localhost identified by 'wp';
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 'wp'' at line 1
如下图:
折腾后发现是mysql版本语法的问题;解决办法如下:
1、查看mysql版本,命令:select version();
2、看到是8.0以上的版本,正确创建数据库及用户配置的步骤和语法如下:
2.1 创建账户:create user '用户名'@'访问主机' identified by '密码';
2.2 赋予权限:grant 权限列表 on 数据库 to '用户名'@'访问主机' ;(修改权限时在后面加with grant option);
亲测有效,截图如下: