Mycmd

Gem Version Build Status Coverage Status Code Climate

MySQL command line tool.

Installation

Add this line to your application's Gemfile:

gem 'mycmd'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mycmd

Or clone from Github:

$ git clone https://github.com/i2bskn/mycmd.git

Settings

Create settings file:

$ touch ~/.mycmd.yml
$ mycmd config edit

Setting is the same as the argument of Mysql2::Client.new.

Sample settings:

host: localhost
port: 3306
username: root
password: secret
tasks:
  slow: SELECT start_time, db, query_time, rows_sent, sql_text FROM mysql.slow_log WHERE db != 'mysql' ORDER BY start_time DESC LIMIT 30

Usage

Start sql shell:

$ mycmd console
mysql>

Execute sql:

$ mycmd query "SELECT * FROM somedb.sometable"
$ mycmd tasks slow

Config Commands

Print current config file path:

$ mycmd config which

Print current config:

$ mycmd config cat

Edit config file:

$ mycmd config edit

Setting Commands

Search settings:

$ mycmd settings search innodb_buffer_pool_size

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request