LoginSignup
3
3

More than 5 years have passed since last update.

mysql 初めからtable作成まで一連のコマンド備忘録

Posted at

普段railsばっかりなのでmysql生であんまり触らないゆえにコマンドのsyntaxたまにググりがちなの手間なので備忘録。

rootでmysqlログイン

mysql -u root -p

user作成

CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass';

userに権限与える

grant all privileges on db名.table名 to 'user名'@'host名' with grant option;

table作成

CREATE TABLE table名 (colum名 type名);

value insert

INSERT INTO table名 (col名たち) VALUES(valueたち)

index追加

CREATE INDEX part_of_name ON customer (name(10));

not null追加とか

ALTER TABLE Person MODIFY P_Id INT(11) NOT NULL;

いや初めからcheatsheetでぐぐればよかったんだ(情弱..)

3
3
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
3
3