Created
November 1, 2012 07:13
-
-
Save trmtsy/3992278 to your computer and use it in GitHub Desktop.
MySQLでよく使うコマンドをメモ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ログイン | |
$ mysql -u ユーザー名 -h ホスト名 -D データベース名 -p | |
rootのパスワードを設定 | |
$ mysqladmin -u root password 'パスワード' | |
ダンプ | |
$ mysqldump -h ホスト名 -u ユーザー名 データベース名 -p | |
DB作成 | |
mysql> CREATE DATABASE データベース名; | |
ユーザー作成 | |
mysql> GRANT ALL PRIVILEGES ON *.* TO ユーザー名@localhost IDENTIFIED BY 'パスワード'; | |
DB一覧 | |
mysql> SHOW DATABASES; | |
DBの選択 | |
mysql> USE データベース名; | |
テーブル一覧 | |
mysql> SHOW TABLES; | |
ユーザー一覧 | |
mysql> SELECT host,user,password FROM mysql.user; | |
設定を確認 | |
mysql> STATUS; | |
テーブル定義を見る | |
mysql> SHOW FULL COLUMNS FROM テーブル名; | |
文字コードを確認 | |
mysql> SHOW VARIABLES LIKE 'char%'; | |
終了 | |
mysql> EXIT | |
Bye |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment