MySQL存储过程DEFINER =`root` @`%`在localhost中不起作用?
首先,您需要检查主机。主机可以是“ localhost”或“%”。检查主机的用户帐户是否存在-
mysql> select user,host from MySQL.user;
这将产生以下输出-
+------------------+-----------+| user | host |
+------------------+-----------+
| Bob | % |
| User2 | % |
| mysql.infoschema | % |
| mysql.session | % |
| mysql.sys | % |
| root | % |
| @UserName@ | localhost |
| Adam Smith | localhost |
| David | localhost |
| James | localhost |
| John | localhost |
| John Doe | localhost |
| User1 | localhost |
| am | localhost |
| hbstudent | localhost |
| mysql.infoschema | localhost |
| mysql.session | localhost |
+------------------+-----------+
17 rows in set (0.00 sec)
现在,我们将更改用户Bob的定义器,并且主机为'%'。以下是使用定义程序创建存储过程的查询-
mysql> DELIMITER //mysql> CREATE DEFINER=`Bob`@`%` PROCEDURE `Message`()
BEGIN
select "Hello World";
END
//
mysql> DELIMITER ;
现在借助CALL命令调用存储过程-
mysql> call `Message`();
这将产生以下输出-
+-------------+| Hello World |
+-------------+
| Hello World |
+-------------+
1 row in set (0.00 sec)
以上是 MySQL存储过程DEFINER =`root` @`%`在localhost中不起作用? 的全部内容, 来源链接: utcz.com/z/321613.html