declare username char(16); //user表里的user就是char(16)类型的
begin
...
set username = '用户名';
grant insert on db.* to username@'localhost';
...
end
但总是提示ERROR 1133 (42000): Can't find any matching row in the user table
username = '用户名' 绝对是正确的,因为在存储过程里用 select user from mysql.user where user = username 是有结果的,但是用grant就不行,难道grant命令不支持变量吗作者: kider 时间: 2013-5-15 11:46
要看清楚是否有这个用户,可以用show grants for username@'localhost'; 验证。