【问题标题】:GRANT access to ROOT授予对 ROOT 的访问权限
【发布时间】:2015-03-10 12:30:50
【问题描述】:

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

我删除了用户“root”的所有访问权限。现在我看不到桌子了。

我尝试在另一个用户下登录,但它不允许我。

此时我有什么选择?

第一步。

//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)    

【问题讨论】:

  • 您看不到表格,但如果您能够以“root”身份登录,那么您可以像 REVOKE 一样授予权限。
  • mysql> 使用授予选项将 . 上的所有权限授予 'root'@'%';错误 1045 (28000): 用户 'root'@'localhost' 的访问被拒绝(使用密码:否)
  • Viswanath Polaki 没有解决问题

标签: mysql


【解决方案1】:

您需要使用 --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

【讨论】:

  • mysql 授予 .使用密码('')标识的授予选项到'root'@'%'; qsh: 001-0050 第 6 行的语法错误:令牌 "(" 不是预期的。------------ mysql 使用授权选项将 . 上的所有权限授予 'root'@'%';/ 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 associates . 版权所有. ---------- Mysql -u root ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp /mysql.sock' (2)
  • 试试 PASSWORD('') 并确保使用单勾
  • 授予 .使用 PASSWORD('') 标识的授权选项到 'root'@'%'; qsh:001-0050 第 3 行的语法错误:令牌“(”不是预期的。
  • 尝试:使用mysql;将数据库上的所有权限授予 PASSWORD('') 标识的 'root'@'%' ;使用授予选项将您数据库上的所有权限授予“root”@“%”;
  • 无连接。正在尝试重新连接... 连接 ID:4 当前数据库:*** NONE *** 错误 1044(42000):用户 'root'@'localhost' 拒绝访问数据库 'mysql' 错误 1046(3D000):没有数据库已选择 ERROR 1046 (3D000): 未选择数据库
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-09-09
  • 1970-01-01
  • 2012-01-19
  • 1970-01-01
  • 2018-02-06
  • 1970-01-01
  • 2019-07-27
相关资源
最近更新 更多