MySQL 5.5の開発作業用初期設定

MySQL 5.5の初期設定。よく忘れるので備忘録として。

■データベース作成

$ mysql -u root -p
mysql> create database [tablename];
Query OK, 1 row affected (0.06 sec)

■ユーザー登録

mysql> create user ‘[username]’@’[localhost]’ identified by ‘[passsword]’;
Query OK, 0 rows affected (0.00 sec)

mysql> grant select,insert,update,delete on [databasename].* to ‘[username]’@’[localhost]’;
Query OK, 1 row affected (0.06 sec)

■ログイン

$ mysql -u [username] [databasename] -p
Enter password: **********
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.5.9 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql>

■テーブル作成 (rootで実行)

$ mysql -u root [databasename] -p
Enter password: **********
mysql > source [/path/to/filename.sql]

One Reply to “MySQL 5.5の開発作業用初期設定”

Leave a Reply