Last Update: "2014/04/04 10:58:09 makoto"

操作

シェルから接続するには、次のようにします。
 mysql -p -u USER -h HOST DATABASE
具体的には、次のようになります。
 mysql -p -u taro -h example personal
-p を指定しているので、Password: と聞いて来ますから taro に設定された パスワードを入力します。
Enter password: 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1413 to server version: 4.1.11

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> 
http://dev.mysql.com/doc/mysql/ja/getting-information.html
mysql -u root -p mysql
Enter password: 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 15885 to server version: 4.1.11

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| func                      |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| host                      |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
+---------------------------+
15 rows in set (0.01 sec)

mysql>  select * from db;
...
パスワードを設定する一つの方法:
次のようにして mysql データべースの user 表の password 欄を直接変更する:
ttyp0:root@umax 19:40:37/070621(~)# mysql -u root -p mysql
Password:
mysql > update user set password = PASSWORD('hogehoge') where Host='192.168.1.1';
または
mysql > update user set password = PASSWORD('hogehoge') where Host='192.168.1.1' and User = 'who';