#1130-主机';localhost';不允许连接到这个MySQL服务器奇怪的消息


#1130 - Host 'localhost' is not allowed to connect to this MySQL server weird message?

所以我最近注册了一个PHP,我正要创建一个数据库,但随后出现了以下消息:

Error
MySQL said: Documentation
# 1130 - Host 'localhost' is not allowed to connect to this MySQL server

然后它告诉我去我的config.inc.php,我到了那里,这里有信息:

<?php
/*
 * This is needed for cookie based authentication to encrypt password in
 * cookie
 */
$cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */
/*
 * Servers configuration
 */
$i = 0;
/*
 * First server
 */
$i++;
/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';
/* Bind to the localhost ipv4 address and tcp */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = '';
/* Advanced phpMyAdmin features */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
$cfg['Servers'][$i]['relation'] = 'pma_relation';
$cfg['Servers'][$i]['table_info'] = 'pma_table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma_column_info';
$cfg['Servers'][$i]['history'] = 'pma_history';
$cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
$cfg['Servers'][$i]['tracking'] = 'pma_tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma_userconfig';
$cfg['Servers'][$i]['recent'] = 'pma_recent';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma_table_uiprefs';
/*
 * End of servers configuration
 */
?>

现在,正如你所看到的。我连接的是127.0.0.1,不是localhost/phpmyadmin,而是127.0.0.1/hpmyadmin。我向你保证,我怀疑config.inc有问题。然而,自从我安装wordpress.org以来,就发生了这种情况,但今天我注意到了。我该如何修复这种问题?

MySQL服务器的其他连接是否正常?

我在过去两次看到过这种错误:

  • mysql.user表完全为空,根本不提供任何特权。例如,SUSE Studio在某个时候生产了这样的虚拟机(也许情况仍然如此,我没有检查)
  • mysql.user中缺少localhost主机。对于MySQL,localhost127.0.0.1是不同的——第一个用于基于套接字的连接,而后者用于基于TCP的连接