mysql报错解决方式:1449 - The user specified as a definer (‘root‘@‘%‘) does not exist

cmd下连接上mysql,分别输入下面命令

grant all privileges on *.* to root@"%" identified by ".";

 FLUSH PRIVILEGES;

在输入第一句后如果遇到下面报错,可采取后面的方式

grant all privileges on *.* to 'root'@'%' identified by "password";
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 "password"' at line 1

原因:mysql版本是8,所以拆成两句执行

create user 'root'@'%' identified by 'password';
grant all privileges on *.* to 'root'@'%';

版权声明:本文为qq_44275894原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。