我在我的窗口安装了xampp。之前,我可以使用我的用户名和密码轻松登录我的phpmyadmin。很长一段时间后,我无法使用以下消息登录phpmyadmin:
#1045 Cannot log in to the MySQL server
Connection for controluser as defined in your configuration failed.
我相信我的密码是真的(来自config.inc.php)
这是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'] = 'cookie'; // Authentication method (config, http or cookie based)
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['password'] ='1234';
$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'] = 'root';
$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
*/
?>
答案 0 :(得分:4)
根据您发布的config.inc.php
,您的root用户密码是1234(正如我在行$cfg['Servers'][$i]['password'] ='1234';
中看到的那样),但是当您定义控制用户时,您将在文件中稍后使用空密码。
我建议设置一个权限比root少的实际控制用户,但快速解决方法是编辑并进行此更改:$cfg['Servers'][$i]['controlpass'] = '1234';
要创建controluser帐户,请使用与此类似的SQL命令:
GRANT SELECT, INSERT, UPDATE, DELETE ON <pma_db>.* TO 'pma'@'localhost' IDENTIFIED BY 'pmapass';
将<pma_db>
的phpMyAdmin配置存储数据库(可能是'phpmyadmin')的名称替换为pmapass
的自定义密码。