====== MySQL サーバのインストール ====== ===== インストール ===== apt-get でインストール。 $ sudo apt-get install mysql-server インストール中に root ユーザのパスワードを聞かれるので入力。 インストールが終わると自動的に起動される。起動の確認は以下のコマンドで。 $ sudo netstat -tap | grep mysql tcp 0 0 localhost:mysql *:* LISTEN 2556/mysqld ===== 設定 ===== /etc/mysql/my.cnf が設定ファイル。こいつを編集。 $ sudo vi /etc/mysql/my.cnf サーバに割り当てる IP アドレスを設定する。 bind-address = 192.168.10.10 192.168.10.10 は サーバの IP に置き換える。 文字コードに関する設定を追加。 [client] default-character-set=utf8 [mysqld] default-character-set=utf8 skip-character-set-client-handshake MySQL サーバを再起動。 $ sudo service mysql restart 初期設定コマンドを使う。 $ sudo mysql_secure_installation * Enter current password for root (enter for none): * 設定した root のパスワードを入力 * Change the root password? [Y/n] * 変更しない n * Remove anonymous users? [Y/n] * 匿名ユーザを削除する y * Disallow root login remotely? [Y/n] *ネットワークからの root アクセスを拒否する y * Remove test database and access to it? [Y/n] * テスト用のデータベースとアクセス権を削除する y * Reload privilege tables now? [Y/n] * すぐに設定を適用する y ===== コマンド ===== ==== ルートパスワードの変更 ==== $ sudo dpkg-reconfigure mysql-server-5.1 ===== 参考 ===== [[https://help.ubuntu.com/10.04/serverguide/C/mysql.html|Ubuntu 公式マニュアル]]