LoginSignup
6
6

More than 5 years have passed since last update.

MySQL コマンドメモ

Last updated at Posted at 2014-09-02

index を見る

show index from table_name;

index を貼る

ALTER TABLE table_name ADD INDEX index_name (column1, column2)

index を削除する

ALTER TABLE table_name DROP INDEX index_name;

column をDROPする

ALTER TABLE table_name DROP column_name;

record を DELETEする

delete from schema_migrations where version="20140728111111";

tableの容量を見る

show table status like 'users'\G;

接続しているprocessを見る

show processlist;

slaveの状況確認

show slave status\G

slaveでqueryをskipする場合

SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
START SLAVE SQL_THREAD;

database を createする

CREATE DATABASE db_name

cnfの場所を確認する

mysql --help | grep my.cnf

genral logを出力する

[mysqld]
#  Query log
general_log=1
general_log_file="/var/log/mysql/sql.log"
log_output=FILE
6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6