简体   繁体   English

无法连接到Openshift上的MySQL服务器

[英]Cannot connect to MySQL server on Openshift

Recently, I've started using openshift & also deployed an application using PHP & MySQL. 最近,我开始使用openshift,还使用PHP和MySQL部署了一个应用程序。 Yesterday, out of curiosity, I've removed the password for phpMyAdmin and guess what, now I'm unable to log in to both phpMyAdmin & mysql database. 昨天,出于好奇,我删除了phpMyAdmin的密码,然后猜测是什么,现在我无法登录phpMyAdmin和mysql数据库。

I've tried both the passwords (the default one & the empty password) and uninstalled & re-installed the PHPmyAdmin catridge & also, force restarted the app several times but nothing worked. 我已经尝试过使用密码(默认密码和空密码),并卸载并重新安装了PHPmyAdmin catridge,并且,强制几次重新启动了该应用程序,但无济于事。 Now, I've no idea what happened. 现在,我不知道发生了什么。 Any help is appreciated. 任何帮助表示赞赏。

Hopefully this will help. 希望这会有所帮助。

I assume what you did was go into phpmyadmin and click on 'users' then 'edit privileges' for one of the users, select 'no password' and hit save right? 我假设您所做的是进入phpmyadmin并单击“用户”,然后单击其中一个用户的“编辑特权”,选择“无密码”,然后单击“保存”? If so, then I think the following steps should help. 如果是这样,那么我认为以下步骤应该会有所帮助。

1.) ssh into your gear (you can use the rhc ssh command) 1.)SSH进入您的设备(可以使用rhc ssh命令)
2.) run the mysql command 2.)运行mysql命令
3.) You should get an error like this ERROR 1045 (28000): Access denied for user 'adminslULJTS'@'127.10.126.130' (using password: YES) 3.)您应该收到类似ERROR 1045 (28000): Access denied for user 'adminslULJTS'@'127.10.126.130' (using password: YES)
4.) Now, type in the command mysql -u $OPENSHIFT_MYSQL_DB_USERNAME -h $OPENSHIFT_MYSQL_DB_HOST -P $OPENSHIFT_MYSQL_DB_PORT -p 4.)现在,键入命令mysql -u $OPENSHIFT_MYSQL_DB_USERNAME -h $OPENSHIFT_MYSQL_DB_HOST -P $OPENSHIFT_MYSQL_DB_PORT -p
5.) When it asks for a password, just hit enter 5.)要求输入密码时,只需按Enter
6.) You should now be logged into the mysql shell 6.)您现在应该登录到mysql shell

Now you need to reset your password to what openshift thinks it is. 现在,您需要将密码重置为openshift认为的密码。

1.) create another ssh session into your gear in another terminal, leaving the old one open 1.)在另一个终端中,在您的设备中创建另一个ssh会话,使旧的会话保持打开
2.) run the command env | grep MYSQL 2.)运行命令env | grep MYSQL env | grep MYSQL
3.) this will give you the following information that you will need to reset your password: 3.)这将为您提供以下信息,您需要这些信息来重置密码:

OPENSHIFT_MYSQL_DB_HOST=127.10.126.130  
OPENSHIFT_MYSQL_DB_PASSWORD=Il8-rVLIKSrx  
OPENSHIFT_MYSQL_DB_USERNAME=adminslULJTS

Given the above information, go back to your ssh session that had the mysql connection open, and enter the following command: 根据上述信息,返回到已打开mysql连接的ssh会话,然后输入以下命令:

set password for 'adminslULJTS'@'127.10.126.130' = PASSWORD('Il8-rVLIKSrx');

But you will need to replace the username, host, and password with the ones you got from the above step. 但是您将需要用从上述步骤中获得的用户名,主机和密码替换用户名,主机和密码。

You should now be able to log into phpmyadmin with your old username & password that you can either view using the env | grep MSYQL 现在,您应该可以使用旧的用户名和密码登录phpmyadmin,您可以使用env | grep MSYQL env | grep MSYQL command, or view in the web console for your application at openshift.com env | grep MSYQL命令,或在Web控制台中查看您的应用程序的openshift.com

It also might be worth reviewing this KB article: https://www.openshift.com/kb/kb-e1085-possible-complications-when-changing-your-database-credentials 也可能值得阅读以下知识库文章: https : //www.openshift.com/kb/kb-e1085-possible-complications-when-changing-your-database-credentials

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

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