インストールから取敢えず設定


先ずは、ユーザとディレクトリを作成する

# groupadd mysql
# adduser -g mysql -d /usr/local/var mysql


ソースを取得し、コンパイルでインスト

$ wget mysql-download-site
$ tar -zxvf mysql.tar.gz
$ cd mysqldir
$ ./configure --with-charset=utf8 -with-extra-charsets=all --with-mysqld-user=mysql
$ make
# make install


データディレクトリのオーナーをmysqlユーザーに変更

# /usr/local/bin/mysql_install_db --user=mysql
# chown -R mysql /usr/local/var
# chgrp -R mysql /usr/local/var


起動してみる

$ /usr/local/bin/safe_mysqld --user=mysql &


スタートアップの設定

$ cd support-files
$ mv mysql.server rc.mysql
$ chmod +x rc.mysql
$ mv rc.mysql /etc/rc.d/init.d/
$ cd /etc/rc.d/rc2.d/
$ ln -s ../init.d/rc.mysql S90mysql
$ cp my-XXX.cnf /etc/my.cnf


root のパスワードを忘れた場合の対処方法

# su
# killall mysqld      ( killall -9 mysqld としてはいけません!)
# /usr/local/mysql/bin/safe_mysqld --user=root --skip-grant-tables &
# mysql mysql
    mysql> select * from user;
    mysql> update user set Password=null where Host='localhost' and User='root';
    mysql> exit
# mysqladmin --user=root password your_new_password


ユーザ作成

mysql> use mysql;                                   // mysql データベースを使用します
mysql> grant select,insert,update,delete,index, \
       alter,create,drop,references, lock tables, \
       create temporary tables on my_db.* to mysql@172.29.30.8 \
       identified by 'mysql';
mysql> flush privileges;                            // 権限を今すぐ有効にします


ちなみに、mySQLRPMパッケージからインストールする

# rpm -ivh MySQL-VERSION.i386.rpm
# rpm -ivh MySQL-client-VERSION.i386.rpm
# rpm -ivh MySQL-bench-VERSION.i386.rpm
# rpm -ivh MySQL-devel-VERSION.i386.rpm
# rpm -ivh MySQL-shared-VERSION.i386.rpm