简体   繁体   English

PHPMyAdmin#1045无法登录到MySQL服务器

[英]PHPMyAdmin #1045 Cannot log in to the MySQL server

Ok, I am ready to blow my brains out on this one and before you guys tell me to just look at the right this question has been answered... I have tried every solution as I will outline below. 好的,我已经准备好动脑了,在你们告诉我先看看正确的问题之前,我已经尝试了所有解决方案,下面将概述。 Currently I am trying to setup a dedicated server following this guide: http://openlitespeed.com/threads/server-setup-guide-part-3-centos-openlitespeed-percona-with-pictures.120/ 目前,我正在尝试按照此指南设置专用服务器: http : //openlitespeed.com/threads/server-setup-guide-part-3-centos-openlitespeed-percona-with-pictures.120/

I am already on part 3 where I should be done installing PHP MyAdmin and so far everything has gone off no problem. 我已经在第3部分中完成了安装PHP MyAdmin的工作,到目前为止,一切都没有问题。 However when I try to log into PHPMyAdmin I keep getting "#1045 Cannot log in to the MySQL Server". 但是,当我尝试登录PHPMyAdmin时,我不断收到“#1045无法登录到MySQL服务器”。 So I poured through all the articles on the right and tried everything so far including: updating the config.php file to include user and pass, my config is as follows: 因此,我仔细阅读了右侧的所有文章,并尝试了到目前为止的所有内容,包括:更新config.php文件以包括用户名和密码,我的配置如下:

/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] ='myPass';

/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

Now if I login via SSH and move to my root user I can run sudo service mysql stop , then mysqld_safe --skip-grant-tables . 现在,如果我通过SSH登录并移至我的root用户,则可以运行sudo service mysql stop ,然后运行mysqld_safe --skip-grant-tables From there I can wipe my browser history as some of the solutions suggested a cookie issue. 在这里,我可以清除浏览器的历史记录,因为某些解决方案提示存在Cookie问题。 If I do I can now log into root user using any password as long as its not blank regardless if its my actual password or not. 如果可以,我现在可以使用任何密码登录root用户,只要该密码不为空,无论它是否是我的真实密码。 But once I am in I can not create databases, however I can modify the user table in the mysql database. 但是一旦进入,就无法创建数据库,但是我可以在mysql数据库中修改用户表。 I have done so for all 3 entries there for root localhost, 127.etc, and the ::1. 我已经为根本地主机,127.etc和:: 1那里的所有3个条目执行了此操作。 I even tried copying all three of those rows and creating a different user with the same password. 我什至尝试复制所有这三行,并使用相同的密码创建一个不同的用户。 I then go back to SSH re-enable the mysql service via sudo service mysql start , wipe the browser cookies and what not and bam I can't log in again. 然后我回到SSH,通过sudo service mysql start重新启用mysql服务,清除浏览器cookie和其他内容,然后bam我无法再次登录。 Not with root, not with the new user I created. 不是root用户,不是我创建的新用户。 I have done the same process trying UPDATE mysql.user SET Password=PASSWORD('1234') WHERE User='root'; 我已经尝试了UPDATE mysql.user SET Password=PASSWORD('1234') WHERE User='root';的相同过程UPDATE mysql.user SET Password=PASSWORD('1234') WHERE User='root'; and FLUSH PRIVILEGES; FLUSH PRIVILEGES; before restarting the server, all to no avail. 重新启动服务器之前,一切无济于事。

Now in step 1 of that guide I did nail down mysql as a secure install, but the guide advises to do that and the guide still assumes by step 3 I should be able to login via the phpmyadmin index file located on my server. 现在,在该指南的第1步中,我确实将mysql设置为安全安装,但该指南建议这样做,并且该指南仍假定到第3步,我应该能够通过服务器上的phpmyadmin索引文件登录。 I followed the guide to the T and everything went off exactly as the screen shots suggested. 我按照T指南操作,一切都完全按照屏幕截图的建议进行。

So basically I can stop the service and skip grant tables to get into phpmyadmin but not create databases or do it all via SSH which is not really ideal. 因此,基本上我可以停止该服务并跳过授予表以进入phpmyadmin,但不创建数据库或通过SSH来完成所有操作,这并不是很理想。 Am I missing something here? 我在这里想念什么吗?

Side Note: I had this exact same problem on a Windows7 IIS server while setting it up for my local dev environment, I ended up reverting MySQL versions and problem solved, not sure if that's related but I'd like to stick with the latest version if possible. 旁注:在Windows7 IIS服务器上为我的本地开发环境进行设置时,我遇到了完全相同的问题,我最终恢复了MySQL版本并解决了问题,不确定是否相关,但我想坚持使用最新版本如果可能的话。 I also had a LAMP stack setup on this dedicated server that I remove prior to attempting the OpenLite/Percona setup I am doing now. 在尝试现在正在执行的OpenLite / Percona设置之前,我还删除了此专用服务器上的LAMP堆栈设置。

Save me Stack Overflow codenobi your my only hope! 救我堆栈溢出codenobi是我唯一的希望!

I actually solved this problem. 我实际上解决了这个问题。 I'm not sure what exactly fixed it I feel a combination of things. 我不确定到底是什么固定的感觉,我会感到很多事情。 I uninstalled and reinstalled percona/mysql with the same problem. 我卸载并重新安装了具有相同问题的percona / mysql。 I tried grant all privileges on *.* to root@localhost identified by 'myPass' with grant option; 我尝试将grant all privileges on *.* to root@localhost identified by 'myPass' with grant option; and had the same issue. 并且有同样的问题。

However I was not logging in as true root I was logging in through user2 which is an admin on the server and elevating to root via su . 但是,我没有以真正的root用户身份登录,而是通过user2登录,user2是服务器上的管理员,并通过su提升为root用户。 So instead I stayed as user2, stopped mysql, jumped into mysql via mysql -u root -p , and ran grant all privileges on *.* to user2@localhost identified by 'myPass' with grant option; 因此,我改为保留为user2,停止mysql,通过mysql -u root -p跳入mysql,然后将grant all privileges on *.* to user2@localhost identified by 'myPass' with grant option; . Keeping in mind I had already created a user2 via phpmyadmin directly into the user table earlier while I had access with the skip grant tables. 请记住,当我可以使用跳过授权表进行访问时,我已经通过phpmyadmin直接在用户表中创建了一个user2。

I restarted mysql again bam I can log into phpmyadmin as user2 and I can create databases no problem, not sure why but moving on, thanks guys! 我再次重新启动mysql bam,我可以以user2身份登录phpmyadmin,并且我可以创建数据库,没问题,不知道为什么,但是继续前进,谢谢大家!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM