基本上,我的config.inc.php文件有问题。但是我会描述事件的顺序,以防我弄坏了其他我不知道的东西。无法通过phpMyAdmin访问数据库
我已经在phpMyAdmin中建立了一个数据库,我在本地主机上使用了几个月。它与XAMPP一起安装。根据XAMPP/xamppfiles/phpMyAdmin/README
文件,它是phpMyAdmin Version 3.5.7
。
有一段时间,我已经离开['controluser'] = 'pma' and ['controluserpass'] = 'pmapass'
。几个星期前,我改变这些值,但是,显然创造了一个问题,因为phpMyAdmin的开始向我展示
"Connection for controluser as defined in your configuration failed"
警告所有的时间。尽管如此,我仍然能够做我需要做的一切;所以我一直在使用我的数据库。
昨天我不得不杀了一个已经超过8个小时的查询。之后,phpMyAdmin似乎正在加载其他数据库和表格有点慢。所以我打开了XAMPP并按下了MySQL的停止按钮。很明显,这个按钮不再为我停止MySQL。图标简单地旋转和旋转,仿佛在思考。所以,截至今天,我一直在停止并直接从终端启动MySQL,而不是通过XAMPP Control界面。
由于我看到了controluser的警告,我决定重写config.inc.php文件来解决在那里出现的任何问题。不幸的是,我只会让事情变得更糟。现在我根本无法访问我的数据库。
我已经花了5个小时研究如何设置我的config.inc.php文件,但我仍然无法访问我的数据库。在过去,我使用'config'选项设置了它,并且从不必输入密码。理想情况下,我宁愿拥有密码安全性。但在这个阶段,我很乐意重新获得我的数据库。
现在,localhost/phpmyadmin
转到登录页面,默认情况下为“用户名”输入了“root”。但我似乎无法登录。根据我对config.inc.php所作的调整,有时“用户名”默认为乱码;其他时间出现错误消息而不是登录名。不管是什么我输入密码进入,phpMyAdmin的也不会接受:
2002 Cannot log in to the MySQL server
其他时候,我得到这个错误:
2002 - Can't connect to local MySQL server through socket '/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock' (2) The server is not responding (or the local server's socket is not correctly configured).
我已经试过
之间来回切换$cfg['Servers'][$i]['auth_type'] = 'cookie'
和
$cfg['Servers'][$i]['auth_type'] = 'config'
和
$cfg['Servers'][$i]['connect_type'] = 'tcp'
和
$cfg['Servers'][$i]['connect_type'] = 'socket'
和
$cfg['Servers'][$i]['AllowNoPassword'] = false
和
$cfg['Servers'][$i]['AllowNoPassword'] = true
和之间之间
$cfg['Servers'][$i]['host'] = 'localhost'
和
$cfg['Servers'][$i]['host'] = '127.0.0.1'
似乎没有任何允许访问我的数据库。
目前,我得到的登录画面,并将该错误:
2002 Cannot log in to the MySQL server
我应该怎么改?下面是我的config.inc.php文件:
<?php
$cfg['blowfish_secret'] = '89x7a3f';
$i = 0;
$i++;
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['AllowRoot'] = true;
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = true;
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'pass';
// $cfg['Servers'][$i]['controlhost'] = '';
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'pmapass';
$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['DefaultConnectionCollation'] = 'utf8_general_ci';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma_table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma_tracking';
$cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
$cfg['Servers'][$i]['userconfig'] = 'pma_userconfig';
$cfg['Servers'][$i]['recent'] = 'pma_recent';
// $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
$cfg['DefaultLang'] = 'en';
?>
我一直在不断改变config.inc.php中的各种设置,但没有运气。但是我注意到在这个错误消息指示的目录中没有mysql.sock文件:“#2002 - 无法通过套接字连接到本地MySQL服务器”/ Applications/XAMPP/xamppfiles/var/mysql/mysql。 sock'(2) 服务器没有响应(或本地服务器的套接字未正确配置)。“ StackOverflow.com上的其他人报告了类似的问题,但没有人提出过答案:http://stackoverflow.com/questions/5530215/mysql-problem-no-mysql-sock – user2647547
如果我尝试通过XAMPP关闭MySQL控制并等待足够长时间,我收到此错误消息:“关闭MySQL .................................. ............错误!“ – user2647547
在终端/应用程序/ xampp/xamppfiles/bin/mysqladmin版本 我得到 错误:'无法通过套接字连接到本地MySQL服务器'/ Applications/XAMPP/xamppfiles/var/mysql/mysql.sock'(2)' 检查mysqld是否正在运行,并且套接字:'/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock'存在!与此同时,localhost/phpmyadmin将我的所有数据库和表格带到屏幕上。在重新启动我的电脑之前,它进入了登录屏幕。现在它跳过了,即使我什么都没改变。但phpMyAdmin本身并不连接到数据库或表。 – user2647547