MySQLのインストール

●事前準備

# yum -y install ncurses-devel

●インストール

# groupadd -g 27 mysql
# useradd -u 27 mysql -M -g mysql -s /sbin/nologin -d /data/db/mysql
# mkdir -p /data/db/mysql
# chown mysql. /data/db/mysql/
# chmod 750 /data/db/mysql/
# exit

$ cd /tmp
$ wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.35.tar.gz/from/ftp://ftp.jaist.ac.jp/pub/mysql/
$ tar zxvf mysql-5.1.35.tar.gz
$ cd mysql-5.1.35
$ ./configure \
> --localstatedir=/data/db/mysql \
> --enable-thread-safe-client \
> --with-low-memory \
> --with-charset=utf8 \
> --with-extra-charsets=all \
> --with-ssl --with-mysqld-user=mysql
$ make
$ su -
# cd /tmp/mysql-5.1.35

# make install

●設定

# vi /etc/ld.so.conf.d/mysql.conf
/usr/local/lib/mysql

# ldconfig

# cp /usr/local/share/mysql/my-medium.cnf /etc/my.cnf
# vi /etc/my.cnf

  :
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
default-character-set=utf8 ←追加
  :

# cp /usr/local/share/mysql/mysql.server /etc/rc.d/init.d/mysql
# chmod 755 /etc/rc.d/init.d/mysql

--- 以下、Heartbeat管理のスタンバイの場合はしない ---

# cd /data/db/mysql
# su mysql -s /bin/bash
$ /usr/local/bin/mysql_install_db --user=mysql
$ exit
# chown -R mysql. /data/db/mysql

# chkconfig mysql on ※Heartbeat管理の場合はしない
# /etc/rc.d/init.d/mysql start

# mysqladmin -u root password '********'
# mysql -u root -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.35-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> USE mysql;
Database changed
mysql> DELETE FROM user WHERE password = '';
Query OK, 4 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye