mysql -u root --password=admin < c:\test.sqlmysql -u root --password=admin -e "CREATE USER 'test'@'%' IDENTIFIED BY 'test'"为啥执行上面语句时都会提示:mysqladmin shutdown mysqladmin: shutdown failed; error: 'Access denied. You need the SHUTDOWN privilege for this operation' 错误.公司的机子不提示,家里的机子会提示.

解决方案 »

  1.   

    权限问题,执行这个操作需要有shutdown的权限。
      

  2.   

    你先试一下这个语句,看是否能连上。看上去应该是你的MYSQL服务正处于关机中状态。最好检查一下你的mysqld 进和状态。或者索性重启一下。mysql -u root --password=admin
      

  3.   

    启动命令
    mysql/bin/mysql_safe & 终止命令
    mysql/bin/mysqladmin shutdown -uroot -p 
    输入密码 
    如果出现类似下边的信息,则终止成功。
    STOPPING server from pid file /usr/local/mysql/var/test922.pid 
    081030 17:01:01 mysqld ended 
    [1]+ Done ./mysqld_safe 如果出现类似 
    shutdown failed; error: 'Access denied; you need the SHUTDOWN privilege for this operation 
    说明你当前操作的用户没有shutdown权限,楼主可以先确保操作用户是否有shutdown权限
      

  4.   

    root 不一定就是 有权限的,又不是Linux的root.MySQL的root是可以改成很小的权限的.
      

  5.   

    我的是root用户,所有表的增删改权限都有的.我又没有做过什么修改.怎么会没有权限呢.
    root用户都没有权限了,怎么恢复回去呢.
    为些我重新装了一次mysql,还是这种情况..
      

  6.   


    不好意思,今天才能上网,我的root用户是有登陆权限的,因为我重新安装了一下,并且服务启动了,单建库和表和用户都可以的.
    用 MySQL GUI Tools 操作也畅通无阻.上面的语句执行结果如下.
    E:\Documents and Settings\Administrator>mysql -u root --password=admin
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 132
    Server version: 5.1.37-community MySQL Community Server (GPL)Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>
      

  7.   

    E:\Documents and Settings\Administrator>mysql -u root --password=admin
    连上去后执行一下这个语句。mysql> CREATE USER 'test'@'%' IDENTIFIED BY 'test'
      

  8.   


    mysql> create user 'test'@'%' identified by 'test'
        -> ;
    Query OK, 0 rows affected (0.19 sec)mysql>
      

  9.   

    用 mysql -u root --password=admin 连进去后可以执行 create user 'test'@'%' identified by 'test';
    而如果直接 mysql -u root --password=admin -e "CREATE USER 'test'@'%' IDENTIFIED BY 'test'" 则不行?你的故障现象是这样吗?