MySQLデータベースサーバー構築
30 11 月 2007まずMySQLインストール
# yum -y install mysql-server
|
MySQL設定ファイルを編集
# vi /etc/my.cnf ----------ここから---------- [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Default to using old password format for compatibility with mysql 3.x # clients (those using the mysqlclient10 compatibility package). old_passwords=1 default-character-set = utf8 ← 追加する [mysql.server] user=mysql basedir=/var/lib [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid 最終行に追加 [mysql] default-character-set = utf8 ----------ここまで---------- MySQLを起動する # /etc/rc.d/init.d/mysqld start MySQL を起動中: [ OK ] MySQLを自動起動に登録する # chkconfig mysqld on |
初期設定をする
MySQLにログインする # mysql -u root rootのパスワードを登録する。 mysql> set password for root@localhost=password('パスワード'); mysql> set password for root@'ns.lunq.net'=password('パスワード'); mysql> exit Bye パスワードの確認をする # mysql -u root ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) # mysql -u root -h 'ns.lunq.net' ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) ※ログインできないことを確認 パスワードの確認をする # mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 281358 to server version: 5.0.22 Type 'help;' or 'h' for help. Type 'c' to clear the buffer. mysql> exit Bye # mysql -u root -h 'ns.lunq.net' -p Enter password: Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 281359 to server version: 5.0.22 Type 'help;' or 'h' for help. Type 'c' to clear the buffer. mysql> exit Bye ※パスワードがあればログインできることを確認 |
以上で設定は終わりです。
適当にデータベースを作って 登録、変更等をしてみましょう。
No comments yet
