Mycmd
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
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
Display current config file path:
$ mycmd config which
Display current config:
$ mycmd config cat
Edit config file:
$ mycmd config edit
Setting Commands
Search settings:
$ mycmd settings search innodb_buffer_pool_size
Display memory related settings:
$ mycmd settings memories
Status Commands
Display database sizes:
$ mycmd status size
Display query cache hit rate:
$ mycmd status qcache_hit_rate
Display innodb buffer pool hit rate:
$ mycmd status innodb_buffer_hit_rate
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request