MySQL の設定
- Debian で Dotdeb から最新のPHP , MySQL をインストールする | レンタルサーバー・自宅サーバー設定・構築のヒント
- Debian MySQL5のインストールと設定
- ユーザーの作成(CREATE USER文) - ユーザーの作成 - MySQLの使い方
- MySQLのユーザ管理
root でログインしてユーザーを作成する
mysql> create user -> 'USERNAME'@'localhost' identified by 'hogehoge';
$ mysql -u USERNAME -p Enter password: mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | +--------------------+ 1 row in set (0.00 sec)
↑権限がないので 1 つの DB しか見えていない
mysql> grant all on testdb.* to USERNAME@localhost; mysql> flush privileges;
↑権限を付与する
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | testdb | +--------------------+ 2 rows in set (0.00 sec)
↑testdb も見えるようになる
MySQL の設定ファイル my.cnf の場所
$ sudo find / -name my.cnf /etc/mysql/my.cnf
少し編集する
[mysqld] default-character-set = utf8 init-connect = "SET NAMES utf8" language = /usr/share/mysql/japanese
port は 3306 番なのね。