用rhc找回Openshift 中的 mysql密码

曾经有一份数据库账号密码摆在我面前,我没有珍惜,直到失去了才后悔莫及……╮( ̄▽ ̄”)╭

如果说菜鸟到高手的路就是一条不断减少犯二次数的漫长征程,鉴于我现在还离起点没多远,每周把范过的二拿出来洗一洗估计都能炒一盘菜吃了。

这个博客搭建在redhat的Openshift应用平台上,当初看的教程说安装完phpmyadmin之后会显示数据库信息:

偷来的图

可是我当初手一贱直接就浏览器右上角小红叉然后奔去食堂会红烧肉。之后想要备份数据库到本地并且用localhost链接时才发现……本地数据库连接错误啊!

原来是因为openshift用的mysql数据库名在我本地数据库里不存在。

于是我想啊,如果我用和openshift相同的设置在本地建一个新的数据库,用户名和密码也和openshift的一样,不就可以在本地操作一个和线上完全一样的blog了么?(菜鸟如我也只能想到这么多了,如果有别的方法,请高手指教,多谢~)

可是可是!去Openshift网站My Application里,查!不!到!数!据!库!信!息!啊!(PД`q。)·。’゜

于是经过和英文Doc的一番奋战,终于哼哼哼……

还记得redhat client tool 么?官方建议(也算是强制了)使用的Openshift命令行管理工具,让它帮一帮你吧。

–help是程序员最好的伙伴Shell

    C:\Program Files\PowerCmd>rhc --help

出来这些信息:

    Usage: rhc [--help] [--version] [--debug] <command> [<args>]

    Command line interface for OpenShift.

    Getting started:
      setup              Connects to OpenShift and sets up your keys and domain
      app create         Create an application
      apps               List all your applications
      cartridge list     List available cartridges
      cartridge add      Add a cartridge to your application
      server             Display information about the status of the OpenShift
    service.
      account logout     End the current session

    Working with apps:
      app restart        Restart the application
      app show           Show information about an application
      tail               Tail the logs of an application
      port-forward       Forward remote ports to the workstation
      threaddump         Trigger a thread dump for JBoss and Ruby applications.
      snapshot           Save the current state of your application locally
      git-clone          Clone and configure an application's repository locally

    Management commands:
      account            Display details about your OpenShift account
      alias              Add or remove a custom domain name for the application
      app                Commands for creating and managing applications
      authorization      Display the authorization tokens created under your
    account
      cartridge          Manage your application cartridges
      domain             Manage the domain and namespace for your applications.
      sshkey             Manage multiple keys for the registered rhcloud user.

看到这句了么 ?

    apps               List all your applications

于是我…

    C:\Program Files\PowerCmd>rhc apps

结果皆大欢喜:

    blog @ http://blog-hikerpig.rhcloud.com/ (uuid: !这个不能告诉你哟!)
    -------------------------------------------------------------------------
      Created:         Mar 23 11:29 AM
      Gears:           1 (defaults to small)
      Git URL:        
     ssh://!这个不能告诉你哟![email protected]/~/git/blog.git/
      Initial Git URL: git://github.com/openshift/wordpress-example.git
      SSH:             !这个不能告诉你哟!@blog-hikerpig.rhcloud.com
      Aliases:         www.hikerpig.asia  

      mysql-5.1 (MySQL Database 5.1)
      ------------------------------
        Gears:          Located with php-5.3, phpmyadmin-3.4, mongodb-2.2
        Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/
        Database Name:  blog
        Password:       !!看这里看这里!!
        Username:       !!看这里看这里!!

      ------------还有好长长长长------------------

总算找出了数据库用户名和密码。

Over!红烧肉我又来了!

你可能感兴趣的:(PHP,openshift)