在CentOS下安裝配置MySQL-5.0.77過程
近日在CentOS下安裝配置成功了MySQL-5.0.27(事實上這種安裝方法適合任何Linux版本),特記下來備忘。^_^
我在安裝CentOS是一直是選擇最小安裝(為了在linux下安裝某某,安裝linux已經無數遍了),只選擇了安裝包中的development tools,導致configure或make 的時候總是出錯,後來選中了 development library 就安裝成功了。
2. 安裝
·解壓
# tar xzvf mysql-5.0.77.tar.gz |
·安裝配置
# cd mysql-5.0.77 # mkdir /usr/local/mysql # ./configure --prefix=/usr/local/mysql --localstatedir=/var/lib/mysql --with-comment=Source --with-server-suffix=-Community --with-mysqld-user=mysql --without-debug --with-big-tables --with-charset=utf8 --with-collation=utf8_unicode_ci --with-extra-charsets=all --with-pthread --enable-static --enable-thread-safe-client --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-assembler --without-innodb --without-isam --without-ndb-debug --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock |
配置成功後會提示:
MySQL has a Web site at http://www.mysql.com/ which carries details on the
latest release, upcoming features, and other information to make your
work or play with MySQL more productive. There you can also find
information about mailing lists for MySQL discussion.
Remember to check the platform specific part of the reference manual for
hints about installing MySQL on your platform. Also have a look at the
files in the Docs directory.
Thank you for choosing MySQL!
·編譯
#make |
過程比較長(配置時做了很多優化),請耐心等待
·安裝
#make install |
3. 安裝後的配置
將mysql的配置檔案copy到/etc目錄下,並更名為my.cnf /user/local/mysql/share/mysql/my-small.cnf 最小配置安裝,記憶體<=64M,資料數量最少 /user/local/mysql/share/mysql/my-large.cnf 記憶體=512M /user/local/mysql/share/mysql/my-medium.cnf 32M<記憶體<64M,或者記憶體有128M,但是資料庫與web伺服器公用記憶體 /user/local/mysql/share/mysql/my-huge.cnf 1G<記憶體<2G,伺服器主要執行mysql /user/local/mysql/share/mysql/my-innodb-heavy-4G.cnf 最大配置安裝,記憶體至少4G # groupadd mysql //新增MySQL組 # useradd -g mysql mysql//新增 mysql 使用者 # bin/mysqld_safe --user=mysql & //啟動mysql,如果一切正常的話,執行此命令後,不會有任何提示。 # bin/mysqladmin -u root password password //修改root使用者的密碼,這裡的root使用者指的是mysql的root使用者,與Linux的root使用者無關。紫色的password就是你需要設定的新密碼,牢記! |
4.參考文章
(1). CentOS 4.4 手動編譯安裝 apache 2.2.3+php 5.2.0+mysql 5.0.27+Zend v3.2.0+eaccelerator 0.9.5
(2). L.A.M.P環境配置文件--CentOS
(3). LINUX下MYSQL完全安裝使用指南
(4).一個很多MySQL版本下載的FTP: