抓原始碼安裝 MySQL 的隨手記錄

o 正式 build MySQL 之前先跑 configure shell 取得 build 資訊:
./configure –prefix=/usr/local/mysql –with-charset=utf8 –with-collation=utf8_unicode_ci

o Build 並且安裝 MySQL:
make; make install

o 安裝基礎的 MySQL database
[root@www mysql]# bin/mysql_install_db –user=mysql
Installing all prepared tables
Fill help tables

To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/local/mysql/bin/mysqladmin -u root password ‘new-password’
/usr/local/mysql/bin/mysqladmin -u root -h www.chihchia.com password ‘new-password’
See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &

You can test the MySQL daemon with the benchmarks in the ‘sql-bench’ directory:
cd sql-bench ; perl run-all-tests

Please report any problems with the /usr/local/mysql/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com

o 設定 MySQL db 所屬目錄擁有者,並且跑起 MySQL 來測試看看:
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe –user=mysql &

注意:
安裝好基礎的 MySQL database 後,mysql_install_db 也會順道建立幾個 root 名稱的使用者,這些使用者的帳號之密碼都沒設定,如之前資訊所示,跑起 MySQL darmon 以後請用 /usr/local/mysql/bin/mysqladmin 去幫那些帳號設定密碼:

/usr/local/mysql/bin/mysqladmin -u root password ‘new-password
/usr/local/mysql/bin/mysqladmin -u root -h www.zhupiter.com password ‘new-password

用 /usr/local/mysql/bin/mysql_secure_installation 問答介面方式設定。

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.