本文介绍了Openshift,无法从控制台连接到 Mysql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过 SSH 连接到我的 openshift 服务器.我输入: env |grep MYSQL

I'm connected via SSH to my openshift server.I type: env | grep MYSQL

OPENSHIFT_MYSQL_DB_PORT=42361
OPENSHIFT_MYSQL_DB_HOST=XXXXXXX-mydomain.rhcloud.com
OPENSHIFT_MYSQL_DB_PASSWORD=MYPASSWORD
OPENSHIFT_MYSQL_PATH_ELEMENT=/opt/rh/mysql55/root/usr/bin
OPENSHIFT_MYSQL_DB_GEAR_UUID=XXXXXXXXX
OPENSHIFT_MYSQL_DB_USERNAME=MYUSERNAME
OPENSHIFT_MYSQL_DB_URL=mysql://MYUSERNAME:[email protected]:42361/
OPENSHIFT_MYSQL_LD_LIBRARY_PATH_ELEMENT=/opt/rh/mysql55/root/usr/lib64
OPENSHIFT_MYSQL_DB_GEAR_DNS=XXXXXXX-mydomain.rhcloud.com

然后,我跑

mysql -u $OPENSHIFT_MYSQL_DB_USERNAME -h $OPENSHIFT_MYSQL_DB_HOST -P $OPENSHIFT_MYSQL_DB_PORT -p

并输入完全相同的密码...但我收到此错误:ERROR 1045 (28000): Access denied for user 'MYUSERNAME'@'10.169.187.123'(使用密码:YES)

and type the exact same password... but I get this error: ERROR 1045 (28000): Access denied for user 'MYUSERNAME'@'10.169.187.123' (using password: YES)

我无法访问 mysql 并且我的应用程序显示 503 不可用错误(我猜是这个原因).

I can't access mysql and my application shows 503 unavailable error (I guess for this reason).

我不想丢失里面存储的数据,所以我想更改密码什么的..但是因为我无法连接到mysql,所以我不能像这样更改psw:

I don't want to lose the data stored inside, so I would like to change password or something.. but since I can't connect to mysql, I can't change the psw like this:

\> set password for 'MYUSERNAME'@'10.169.187.123' = PASSWORD('newpassword');

推荐答案

我知道帖子很旧,但我遇到了同样的问题,@Tadhg 的回答很接近.所以,我在连接到 rhc ssh <APP_NAME> 后,在 rhc 环境中尝试了以下操作,并将我连接到 mysql.

I know the post is old, but I had the same issue and @Tadhg's answer was close. So, I have tried the following in the rhc environment after connecting to rhc ssh <APP_NAME> and it connected me to mysql.

mysql -u $OPENSHIFT_MYSQL_DB_USERNAME -h $OPENSHIFT_MYSQL_DB_HOST --password=$OPENSHIFT_MYSQL_DB_PASSWORD

我必须删除端口,因为它在端口上出错,并且它工作正常.我无法使用 phpMyAdmin,因为我收到错误phpmyadmin-4 无法嵌入可扩展应用程序".

I have to remove the port as it had error on the port, and it worked. I could not use phpMyAdmin as I get error `phpmyadmin-4 cannot be embedded in scalable app ''.

我希望有一天能对某人有所帮助.:)

I hope it helps someone, one day. :)

这篇关于Openshift,无法从控制台连接到 Mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-03 19:01