nginx.service - nginx - high performance web server Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled) Active: active (running) since Mon 2015-08-03 06:07:44 UTC; 2s ago Docs: http://nginx.org/en/docs/ Process: 12642 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS) Process: 12641 ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS) Main PID: 12645 (nginx) CGroup: /system.slice/nginx.service ├─12645 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.... └─12646 nginx: worker process
Aug 03 06:07:44 ip-172-31-19-253 systemd[1]: Starting nginx - high performan.... Aug 03 06:07:44 ip-172-31-19-253 nginx[12641]: nginx: the configuration file...k Aug 03 06:07:44 ip-172-31-19-253 nginx[12641]: nginx: configuration file /et...l Aug 03 06:07:44 ip-172-31-19-253 systemd[1]: Failed to read PID from file /r...t Aug 03 06:07:44 ip-172-31-19-253 systemd[1]: Started nginx - high performanc.... Hint: Some lines were ellipsized, use -l to show in full.
EC2のCentOS7で 以下のように go get した際にbzrが見当たらないというエラーが発生した。
1 2 3 4 5
$ go get launchpad.net/goamz/aws
[centos@ip-xxx-xx-xx-xx src]$ go get launchpad.net/goamz/aws go: missing Bazaar command. See http://golang.org/s/gogetcmd package launchpad.net/goamz/aws: exec: "bzr": executable file not found in $PATH
INFO 2015/08/19 14:48:38 harness.go:165: Listening on :9000 2015/08/19 14:48:40 server.go:1775: http: TLS handshake error from 127.0.0.1:36799: tls: first record does not look like a TLS handshake
SELECT ~ INTO OUTFILE output.csv の場合、DB サーバに /tmp/hoge.csv は出力される。 コマンド実行するサーバと DB サーバが異なる場合は注意が必要です。
1 2
use dbname SELECT * INTO OUTFILE'/tmp/hoge.csv' FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '' LINES STARTING BY '' TERMINATED BY '\r\n' FROM table;
コマンドライン SQL ファイルをロードし実行結果を CSV に保存
1
mysql -h <host> -u <user> -p<password> <db_name> -e "`cat query.sql`" | sed -e 's/\t/,/g' >/tmp/result.csv
ALTER TABLE product CHANGE `no` `id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品ID';
インデックス一覧表示
1
SHOW INDEXES FROM <table>;
インデックス追加
1 2 3
ALTER TABLE <table> ADD INDEX <index name>(<column>);
ALTER TABLE <table> ADD INDEX <index name>(<column1>,<column2>);
インデックス削除
1
ALTER TABLE <table> DROP INDEX <index name>;
ユニーク追加
1
ALTER TABLE <table> ADD UNIQUE(<column>);
ユニーク削除
DB の文字コード確認
1
SHOW CREATE DATABASE dbname
gz 形式で圧縮状態のファイルを特定 DB スキーマへ実行
1
zcat dump.sql.gz | mysql -u <user> -p<password> dbname
全テーブルの統計情報をサイズ順に一覧表示
1
SELECT table_name, engine, table_rows AS tbl_rows, avg_row_length AS rlen, 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;
テーブルの文字コード等確認
1 2 3 4 5 6 7
SELECT * FROM information_schema.schemata WHERE schema_name = 'database_name';