MySQL: 基本です

mysql コマンドをつかって、CUIでコントロールする場合、使い方が分からなければ

mysql> help

でいろいろ出てくる。しかしここから先がよく分からない場合は
mysql> help contents

として、内容一覧を出す。出力はこんな感じ。

mysql> help contents
You asked for help about help category: "Contents"
For more information, type 'help ', where is one of the following
categories:
Account Management
Administration
Compound Statements
Data Definition
Data Manipulation
Data Types
Functions
Functions and Modifiers for Use with GROUP BY
Geographic Features
Language Structure
Plugins
Table Maintenance
Transactions
User-Defined Functions
Utility

たとえばアカウント管理なら
 mysql> help Account Management

とすれば

mysql> help Account Management
You asked for help about help category: "Account Management"
For more information, type 'help ', where is one of the following
topics:
CREATE USER
DROP USER
GRANT
RENAME USER
REVOKE
SET PASSWORD

と、さらにトピックスを列記してくれる。ユーザーをつくりたいなら
mysql> help create user

とすれば

mysql> help create user
Name: 'CREATE USER'
Description:
Syntax:
CREATE USER user [IDENTIFIED BY [PASSWORD] 'password']
[, user [IDENTIFIED BY [PASSWORD] 'password']] ...

The CREATE USER statement creates new MySQL accounts. To use it, you
must have the global CREATE USER privilege or the INSERT privilege for
the mysql database. For each account, CREATE USER creates a new row in
the mysql.user table that has no privileges. An error occurs if the
account already exists. Each account is named using the same format as
for the GRANT statement; for example, 'jeffrey'@'localhost'. If you
specify only the user name part of the account name, a host name part
of '%' is used. For additional information about specifying account
names, see [HELP GRANT].

The account can be given a password with the optional IDENTIFIED BY
clause. The user value and the password are given the same way as for
the GRANT statement. In particular, to specify the password in plain
text, omit the PASSWORD keyword. To specify the password as the hashed
value as returned by the PASSWORD() function, include the PASSWORD
keyword. See [HELP GRANT].

URL: http://dev.mysql.com/doc/refman/5.1/en/create-user.html


と詳しい内容をだしてくれる。


helpの使い方をマスターできた。レベルが上がった。