曾經有一份數據庫帳號密碼擺在我面前,我沒有珍惜,直到失去了才後悔莫及……╮( ̄▽ ̄」)╭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!紅燒肉我又來了!