1.Download MySQL 5.0.9 beta from
http://dev.mysql.com/downloads/mysql/5.0.html
Tarball (tar.gz) 5.0.9-beta
# wget http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.9-beta.tar.gz/from/http://mysql.cdpa.nsysu.edu.tw/
2.
# cd /tmp
# tar zxvf mysql-5.0.9-beta.tar.gz
# cd mysql-5.0.9-beta
# dh_make
如果沒有 dh_make 這個指令,安裝 dh-make。
安裝時期會需要 termcap/courses 順便裝。
# apt-get dh-make libncurses5-dev termcap-compat
# vi debian/rules
底下幾行註解掉
#CFLAGS = -Wall -g
#ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
# CFLAGS += -O0
#else
# CFLAGS += -O2
#endif
加入
CFLAGS=-Wall -g -O3 -march=pentiumpro
CXX=gcc
CXXFLAGS=-O3 -march=pentiumpro -felide-constructors -fno-exceptions -fno-rtti
config.status: configure
dh_testdir
# Add here commands to configure the package.
CFLAGS=""$(CFLAGS)"" ./configure --host=$(DEB_HOST_GNU_TYPE)
--build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man
--infodir=\$${prefix}/share/info --localstatedir=/var/lib/mysql
--with-unix-socket-path=/var/run/mysqld/mysqld.sock --with-charset=big5
後面是 configure 時的參數,可依照需求更改,
--with-charset=big5 若不加入,中文會有問題。
詳細參數可參考 INSTALL-SOURCE
3.
# cd /tmp/mysql-5.0.9-beta
# dpkg-buildpackage
4.
# cd /tmp
# dpkg -i --force-all mysql_5.0.9-beta-1_i386.deb
Note:
1.一般來說,編譯時需要的軟體大概如下 dpkg-dev gcc g++ make patch dh-make
debhelper devscripts fakerootgnupg debmake
2.通常不建議 MySQL 進行大幅度的升級,例如 3.23 --> 4.0 差了一個版號,
但並非不可。3.23 和 4.0 系列重要的差異在於 ""mysql"" 資料庫內的權限資料,
4.x 以後使用較安全的密碼格式? 可使用下列指令修復該資料庫。
# mysql_fix_privilege_tables root_password
其餘資料庫應由原版本 MySQL server 使用 mysqldump 將資料 dump 出來。
# mysqldump -uuser -ppassword -opt database_name > database.sql
復原:
# mysql -uuser -ppassword
mysql> drop database database_name;
mysql> create database database_name;
mysql> quit;
# mysql -uuser -ppassword database_name < database.sql
或者配合 phpMyAdmin 做 dump 和 restore 的動作。
3.剛安裝好的 MySQL 是沒有 root 密碼,可使用下列方法更改
方法一
# mysql -uroot mysql
mysql> UPDATE user SET password=password('new_passwd') where user=root;
mysql> FLUSH PRIVILEGES;
方法二
# mysqladmin -u root password 'new_passwd'
4.若是忘記 MySQL 密碼,使用下列方法
# killall -9 mysqld
# mysqld_safe --skip-grant-tables &
# mysql -uroot mysql
mysql> UPDATE user SET password=password('new_passwd') where user='root';
mysql> FLUSH PRIVILEGES;
Reference:
Debian New Maintainers' Guide
http://www.debian.org/doc/manuals/maint-guide/index.en.html
沒有留言:
張貼留言