MySQL Configuration

Files

Configuration File
  • /etc/my.cnf

Configuration

Initialization
  • Process start & Connection Check
    • /etc/init.d/mysqld start
    • mysql -u root -p
      • 空パスワード
    • help contents
    • help
    • \q
    • DBクライアントコマンドの確認
  • Start Secure Installation
    • mysql_secure_installation
    • enter for none
    • Set root password? y
    • new password
      • MySQLのrootはunixのrootと連動しない。独立したアカウント体系
    • Remove anonymous users? y
      • MySQLは標準で誰でもログインできるようになってしまってる
    • Disallow root login remotely? y
      • MySQLはリモートからログインできる必要はない。
      • 必要であればSSHログインからローカルメンテナンスすれば良い
    • Remove test database and access to it y
      • 本番環境では不要
    • Reload privilege tables now? y
      • 権限の再読み込み。やる。
  • Create Database
    • mysql -u root -p
      • mysql -u root -p は避ける(ログにパスが残る)
    • create database ;
    • show databases
  • Create DB User&Grant Privileges
    • grant all privileges on to identified

by '' with grant option;

      • 特定DBに対する全権限を持ったユーザの作成
    • use
    • create table ( ,...)
    • show tables