曾经有一份数据库帐号密码摆在我面前,我没有珍惜,直到失去了才后悔莫及……╮( ̄▽ ̄”)╭php
若是说菜鸟到高手的路就是一条不断减小犯二次数的漫长征程,鉴于我如今还离起点没多远,每周把范过的二拿出来洗一洗估计都能炒一盘菜吃了。mysql
这个博客搭建在redhat的Openshift应用平台上,当初看的教程说安装完phpmyadmin以后会显示数据库信息:git
但是我当初手一贱直接就浏览器右上角小红叉而后奔去食堂会红烧肉。以后想要备份数据库到本地而且用localhost连接时才发现……本地数据库链接错误啊!程序员
原来是由于openshift用的mysql数据库名在我本地数据库里不存在。github
因而我想啊,若是我用和openshift相同的设置在本地建一个新的数据库,用户名和密码也和openshift的同样,不就能够在本地操做一个和线上彻底同样的blog了么?(菜鸟如我也只能想到这么多了,若是有别的方法,请高手指教,多谢~)sql
但是但是!去Openshift网站My Application里,查!不!到!数!据!库!信!息!啊!(PД`q。)·。’゜mongodb
因而通过和英文Doc的一番奋战,终于哼哼哼……数据库
还记得redhat client tool 么?官方建议(也算是强制了)使用的Openshift命令行管理工具,让它帮一帮你吧。浏览器
--help是程序员最好的伙伴Shellsession
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://!这个不能告诉你哟!8@blog-hikerpig.rhcloud.com/~/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!红烧肉我又来了!