Skip to content

Instantly share code, notes, and snippets.

@ykamez
Created May 11, 2019 01:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ykamez/15d74a9d83debdea780c8b17d51d5bab to your computer and use it in GitHub Desktop.
Save ykamez/15d74a9d83debdea780c8b17d51d5bab to your computer and use it in GitHub Desktop.

mysqlチートシート

  • 基本的な操作
show databases;
use isutomo;
desc tweets;desc users;
  • インデックスの確認
show index from tweets;show index from users;
  • 容量の確認
SELECT table_name, engine, table_rows, avg_row_length, floor((data_length+index_length)/1024/1024) as allMB, floor((data_length)/1024/1024) as dMB, floor((index_length)/1024/1024) as iMB FROM information_schema.tables WHERE table_schema=database() ORDER BY (data_length+index_length) DESC;
  • スロークエリログの設定
show variables like "%slow%"

systemd関連

  • isuがつくユニットを取得 systemctl list-units | grep isu
  • 特定サービスのstatusをみる(リスタートする)など systemctl status (restart, start) isuda.ruby.service

参考

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment