2009年10月30日
mysql移行メモ
mysql4.1から5.1にバージョンアップするための移行検証メモ。
4.1がrpm版なので、5.1はバイナリ版を/usr/local/mysql5に展開。
■初期DB作成
/usr/local/mysql5/scripts/mysql_install_db \
--defaults-file=/usr/local/mysql5/my.cnf \
--user=mysql \
--basedir=/usr/local/mysql5 \
--datadir=/usr/local/mysql5/data \
--pid-file=/usr/local/mysql5/mysql.pid \
--port=3307 \
--socket=/tmp/mysql5.sock
○ログ
Installing MySQL system tables...
OK
Filling help tables...
OKTo start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:/usr/local/mysql5/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql5/bin/mysqladmin -u root -h localhost password 'new-password'Alternatively you can run:
/usr/local/mysql5/bin/mysql_secure_installationwhich will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr/local/mysql5 ; /usr/local/mysql5/bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql5/mysql-test ; perl mysql-test-run.plPlease report any problems with the /usr/local/mysql5/scripts/mysqlbug script!
The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/
■起動
/usr/local/mysql5/bin/mysqld_safe \
--defaults-file=/usr/local/mysql5/my.cnf \
--user=mysql \
--basedir=/usr/local/mysql5 \
--datadir=/usr/local/mysql5/data \
--pid-file=/usr/local/mysql5/mysql.pid \
--port=3307 \
--socket=/tmp/mysql5.sock \
&
■rootパスワード設定
/usr/local/mysql5/bin/mysqladmin -u root password 'password' --socket=/tmp/mysql5.sock
■接続
/usr/local/mysql5/bin/mysql --socket=/tmp/mysql5.sock -u root -p
■ダンプ
/usr/bin/mysqldump -uroot -p --all-databases --default-character-set=utf8 -C -e > /tmp/test.dump
■ロード
/usr/local/mysql5/bin/mysql --socket=/tmp/mysql5.sock -u root -p < /tmp/test.dump

