背景
昨天在做一个小服务时,需要前端同事连接本机 Mysql 进行调试,但是在同一个局域网下连接总是失败,查找资料发现需要将 mysql 授权访问,使用 grant all privileges on * . * to 'user'@'192.168.0.163' identified by '123';
其中 user 是授权用户名,后面的 IP 是允许连接的 IP,最后面则是登陆密码。在 Mysql 执行这条语句报错:
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 'test' with grant option' at line 1You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version