MySQLインストール

8 月 4th, 2008

shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
shell> cd mysql-VERSION
shell> ./configure –prefix=/usr/local/mysql
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysql_install_db –user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> bin/mysqld_safe –user=mysql &

マニュアルそのままだけど、最後の1行は

cp ./support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
chkconfig mysqld on

として

/etc/init.d/mysqld start

とかすると、再起動でも自動で立ち上がるのでよいかもです。


MySQLでトランザクション

5 月 31st, 2008

もしMyIsamだったら

alter table test type=innodb;

SELECT @@autocommit;

SET AUTOCOMMIT=0;

BEGIN;

ROLLBACK;