MySQL #1142 - SELECT 命令拒绝用户 ''@'localhost' 表 'pma_table_uiprefs'
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18424797/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
#1142 - SELECT command denied to user ''@'localhost' for table 'pma_table_uiprefs'
提问by user1558832
Hopefully someone can help me, for I have queried the web with no success or concrete answer to this error. I'm using Windows and Xampp. Here is the error I am getting after I have recently imported the database into phpmyadmin…
希望有人能帮助我,因为我在网上查询过这个错误没有成功或具体的答案。我正在使用 Windows 和 Xampp。这是我最近将数据库导入 phpmyadmin 后遇到的错误...
#1142 - SELECT command denied to user ''@'localhost' for table 'pma_table_uiprefs'
After I import the database, everything is fine in phpmyadmin until I log out and then log back in, this is where the problem lies. When I click on any of the tables from the imported database, I get the following errors…
导入数据库后,phpmyadmin 中一切正常,直到我注销然后重新登录,这就是问题所在。当我单击导入数据库中的任何表时,出现以下错误...
SELECT 'prefs'
FROM 'phpmyadmin'.'pma_table_uiprefs'
WEHRE 'username' = 'root'
AND 'db_name' = 'afdb'
AND 'table_name' = 'role'
#1142 - SELECT command denied to user ''@'localhost' for table 'pma_table_uiprefs'
Thank you again for taking time to read my post and hopefully someone can help me with this error.
再次感谢您花时间阅读我的帖子,希望有人能帮助我解决这个错误。
回答by josemmo
I stumble upon this issue and I solved it just by logging outof phpMyAdmin and in again.
我偶然发现了这个问题,我只是通过注销phpMyAdmin 并再次登录来解决它。
EXPLANATION
解释
Take a look at the error message query:
看一下错误信息查询:
SELECT command denied to user ''@'localhost' for table 'pma_table_uiprefs'
This happens due to MySQL denying access to user "" (blank) at server localhost
. The default setting is to block all requests from anonymous users.
发生这种情况是因为 MySQL 拒绝访问服务器上的用户 "" (blank) localhost
。默认设置是阻止来自匿名用户的所有请求。
By logging out we force phpMyAdmin to "forget" the current user and let us input the login credentials for the MySQL server.
通过注销,我们强制 phpMyAdmin“忘记”当前用户,并让我们输入 MySQL 服务器的登录凭据。
回答by Marc Delisle
The pma_table_uiprefs table contains user preferences. In phpMyAdmin's config.inc.php, access to this table (and other tables in the configuration storage) is done via the control user. In your case, the controluser parameter is empty, therefore the query fails.
pma_table_uiprefs 表包含用户首选项。在 phpMyAdmin 的 config.inc.php 中,对这个表(以及配置存储中的其他表)的访问是通过控制用户完成的。在您的情况下, controluser 参数为空,因此查询失败。
For a short-term fix, put the "//" characters in config.inc.php at the start of this line:
对于短期修复,将“//”字符放在 config.inc.php 中的这一行的开头:
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
then log out and log back in.
然后注销并重新登录。
For a long-term fix, correctly set up the configuration storage, see http://docs.phpmyadmin.net/en/latest/setup.html#phpmyadmin-configuration-storage
如需长期修复,请正确设置配置存储,请参阅http://docs.phpmyadmin.net/en/latest/setup.html#phpmyadmin-configuration-storage
回答by Dhruv
This Will Surely help you
这肯定会帮助你
1.open PhpMyAdmin.
1.打开PhpMyAdmin。
2.on the left side under the PhpMyAdmin logo click on second icon(Empty Session Data).
2.在 PhpMyAdmin 标志下的左侧,单击第二个图标(空会话数据)。
3.that's it.
3.就这样。
回答by Andrew F.
There is another way of solving this.
还有另一种方法可以解决这个问题。
Following the instructions in http://docs.phpmyadmin.net/en/latest/setup.html#phpmyadmin-configuration-storage:
按照http://docs.phpmyadmin.net/en/latest/setup.html#phpmyadmin-configuration-storage 中的说明进行操作:
1.- I opned xampp\phpMyAdmin\config.inc.php file and found the following lines:
1.- 我打开 xampp\phpMyAdmin\config.inc.php 文件,发现以下几行:
/* User for advanced features */\
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = '';
2.- Then I observed in phpmyadmin the following tables:
2.- 然后我在 phpmyadmin 中观察到以下表格:
DATABASE: phpmyadmin
数据库:phpmyadmin
TABLES: pma_bookmark pma_column_info pma_designer_coords pma_history pma_pdf_pages pma_recent pma_relation pma_table_coords pma_table_info pma_table_uiprefs pma_tracking pma_userconfig
表: pma_bookmark pma_column_info pma_designer_coords pma_history pma_pdf_pages pma_recent pma_relation pma_table_coords pma_table_info pma_table_uiprefs pma_tracking pma_userconfig
3.- I run this sql statement:
3.-我运行这个sql语句:
GRANT SELECT , INSERT , UPDATE , DELETE ON phpmyadmin.* TO `pma`@`localhost` IDENTIFIED BY ''
And it worked.
它奏效了。
回答by Manel Clos
On ubuntu, try dpkg-reconfigure phpmyadmin and recreate the phpmyadmin database. I installed using ansible and this was not done.
在 ubuntu 上,尝试 dpkg-reconfigure phpmyadmin 并重新创建 phpmyadmin 数据库。我使用 ansible 安装,但没有完成。
回答by Amal E Thomas
Open the config.inc.php file from C:\xampp\phpmyadmin
Put the "//" characters in config.inc.php at the start of below line:
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
Example: // $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
Reload your phpmyadmin at localhost.
从 C:\xampp\phpmyadmin 打开 config.inc.php 文件
将 "//" 字符放在 config.inc.php 中的以下行的开头:
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
示例: // $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
在本地主机上重新加载您的 phpmyadmin。
回答by matinict
If you use XAMPP Path ( $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; ) C:\xampp\phpmyadmin\config.inc.php (Probably XAMPP1.8 at Line Number 34)
如果您使用 XAMPP 路径 ( $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; ) C:\xampp\phpmyadmin\config.inc.php (可能是 XAMPP1.8 在第 34 行)
Another Solution: I face same type problem "#1142 - SELECT command denied to user ''@'localhost' for table 'pma_recent'"
另一个解决方案:我面临相同类型的问题“#1142 - SELECT command denied to user ''@'localhost' for table 'pma_recent'”
- open phpmyadmin==>setting==>Navigation frame==> Recently used tables==>0(set the value 0) ==> Save
- 打开phpmyadmin==>设置==>导航框==>最近使用的表格==>0(设置值为0)==>保存
回答by Mustafa Ozbalci
I had the same problem and it might look so easy but it solved my problem. I have tried all the solutions recommended here but there was no problem just a day ago. So I thought the problem might be about the Session data. I tried to stop and run apache and mysql services but it didn't work also. Then I realized there are buttons on phpMyAdmin just below its logo on the left side. The button next to "Home"; "Empty Session Data" solved all of my problems.
我遇到了同样的问题,它看起来很简单,但它解决了我的问题。我已经尝试了这里推荐的所有解决方案,但就在一天前还没有问题。所以我认为问题可能出在 Session 数据上。我试图停止并运行 apache 和 mysql 服务,但它也不起作用。然后我意识到 phpMyAdmin 上有按钮,就在左侧徽标的下方。“主页”旁边的按钮;“空会话数据”解决了我所有的问题。
回答by Ebuka
Just log out of phpMyAdmin, that is all you need to do
只需退出 phpMyAdmin,这就是您需要做的所有事情
回答by Bijeesh Raghavan
You use this command in phpMyAdmin SQL Part:
您在 phpMyAdmin SQL Part 中使用此命令:
GRANT SELECT , INSERT , UPDATE , DELETE ON phpmyadmin.* TO `pma`@`localhost` IDENTIFIED BY ''