公司有一台专门的服务器给各个项目组开发用,我的数据库也是跑在上面的
现在想使用MySQL的存储过程,但是在我的数据库创建存储过程的时候老提示
1044-Access denied for user....
上网查了下说用root权限可以
但那么多项目组,各组有各组的数据库,公司规定是不能碰别组数据库的,当然也不可能分配个root权限的出来
这情况下如何创建存储过程?怎么做???
想不通,为啥创建个存储过程还要那么高权限
求教啊~~
知道的都来说点吧,学习嘛多多益善

解决方案 »

  1.   

    对存储过程有三个权限.
     create routine、 alter routine、 execute分别是创建权限、修改权限、执行权限.你把这些权限给你创建的用户就行了。
      

  2.   

    GRANT create routine, alter routine, execute ON *.* TO 'user_name'@'ip' IDENTIFIED BY 'password' WITH GRANT OPTION;
      

  3.   

     创建存储子程序需要CREATE ROUTINE权限。 提醒或移除存储子程序需要ALTER ROUTINE权限。这个权限自动授予子程序的创建者。  执行子程序需要EXECUTE权限。
      

  4.   

    例子:赋予用户uuuu 对数据库aaa 有创建存储过程的权限;
    C:\>mysql -uroot -p
    Enter password: ******
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1
    Server version: 5.1.40-community-log MySQL Community Server (GPL)Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> grant create ROUTINE,alter ROUTINE,EXECUTE on aaa.* to uuuu@localhost ide
    ntified by '123456';
    Query OK, 0 rows affected (0.03 sec)mysql> \q
    ByeC:\>mysql -uuuuu -p123456
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 9
    Server version: 5.1.40-community-log MySQL Community Server (GPL)Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | aaa                |
    +--------------------+
    2 rows in set (0.00 sec)mysql> use aaa;mysql> delimiter $$
    mysql> create procedure pro()
        -> begin
        -> select 'Mablevi' as name;
        -> end;$$
    Query OK, 0 rows affected (0.03 sec)mysql> delimiter ;
    mysql> call pro();
    +---------+
    | name    |
    +---------+
    | Mablevi |
    +---------+
    1 row in set (0.00 sec)Query OK, 0 rows affected (0.03 sec)
      

  5.   

    想省事的话,直接用grant all privileges on DB.* to <user>@localhost ......不过,对于权限问题,分得细一些还是好一些。
      

  6.   

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