dpdbu24262
2014-06-12 19:13
浏览 126
已采纳

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

Recently, I've started using openshift & also deployed an application using 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.

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. Now, I've no idea what happened. Any help is appreciated.

图片转代码服务由CSDN问答提供 功能建议

最近,我开始使用openshift& 还使用PHP& amp;部署了一个应用程序 MySQL的。 昨天,出于好奇,我删除了phpMyAdmin的密码并猜测是什么,现在我无法登录phpMyAdmin& mysql数据库。

我已经尝试了两个密码(默认密码和空密码)并卸载了& 重新安装了PHPmyAdmin catridge& 此外,强制重启应用程序几次,但没有任何工作。 现在,我不知道发生了什么。 任何帮助表示赞赏。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • dongmi1864 2014-06-13 16:46
    最佳回答

    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? If so, then I think the following steps should help.

    1.) ssh into your gear (you can use the rhc ssh command)
    2.) run the mysql command
    3.) You should get an error like this 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
    5.) When it asks for a password, just hit enter
    6.) You should now be logged into the mysql shell

    Now you need to reset your password to what openshift thinks it is.

    1.) create another ssh session into your gear in another terminal, leaving the old one open
    2.) run the command env | grep MYSQL
    3.) this will give you the following information that you will need to reset your password:

    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:

    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 command, or view in the web console for your application at 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

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题