mysqlコマンドの使い方
sorry Japanese only
最終更新日 2004/08/22
page size = Mbyte

MySQLのコマンドの使い方が良く分からないので、成功したコマンドを書いていくことにしました。
使用しているのは Linux用の MySQL3.23.53です。

新しい databaseの作り方

[root]# mysqladmin -u root -p create movabletype
Enter password: hogehoge
これだけで movabletypeという databaseが作成されます。
新たに作成しました!。などのエコーバックはありませんでした。


現在ある Databaseの確認方法

[root]# mysql -u root -p
Enter password: hogehoge
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 328 to server version: 3.23.53-Max-log

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

mysql> show databases;
+-------------+
| Database    |
+-------------+
| movabletype |
| mysql       |
| test        |
+-------------+
3 rows in set (0.00 sec)

mysql> quit
Bye
[root]# 

MySQL root passwordの消し方

[root]# mysqladmin -u root -p password ""


現在ある Databaseを削除する
無茶苦茶危険、一瞬で関連する全テーブル削除 undo無し。

[root]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 94 to server version: 3.23.53-Max-log

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

mysql> show databases;
+-------------+
| Database    |
+-------------+
| mt_data     |
| mysql       |
+-------------+
2 rows in set (0.00 sec)

mysql> DROP DATABASE mt_data;
Query OK, 48 rows affected (0.01 sec)

mysql> show databases;
+-------------+
| Database    |
+-------------+
| mysql       |
+-------------+
1 rows in set (0.00 sec)

mysql> 


13723
戻る