GRANT访问ROOT

时间:2015-03-10 12:30:51

标签: mysql

我使用phpmyadmin来调整用户的权限。

我删除了用户&root;'的所有访问权限。现在我无法看到表格。

我尝试在其他用户下登录,但不允许我这样做。

此时我有哪些选择?

第1步。

//Stop mysql server

    zend
    opt 6 zendDBi
    opt 7 Stop ZendDBi

第2步。

//Start mysql server

    cd /usr/local/mysql/bin  

    mysqld_safe --skip-grant-tables  
    mysql FLUSH PRIVILEGES;  

在我这样做之后,我得到了这么长的文字:

 /usr/local/mysql-5.1.59-i5os-power-64bit/bin/mysql  Ver 14.14 Distrib 5.1.59, for ibm-i5os (power) using readline 5.1
 Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.                                         

  Oracle is a registered trademark of Oracle Corporation and/or its                                                    
  affiliates. Other names may be trademarks of their respective                                                        
  owners.                                                                                                              

   Usage: /usr/local/mysql-5.1.59-i5os-power-64bit/bin/mysql [OPTIONS]     [database]                                       
    -?, --help          Display this help and exit.          
    .............                                                          

刷新后我尝试重新连接mysql服务器我收到此错误:

 mysql -u root                                                                                   
 ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)    

1 个答案:

答案 0 :(得分:0)

您需要使用--skip-grant-tables启动mysql并为root分配密码,在您的情况下,您似乎想要空密码:

1

//Stop mysql server

zend
opt 6 zendDBi
opt 7 Stop ZendDBi

2

//Start mysql server

cd /usr/local/mysql/bin  

mysqld_safe --skip-grant-tables 

3

grant all privileges on . to 'root'@'%' with grant option identified by password('');
flush privileges;

4

exit

5

mysql -uroot