h1. MySQL5.1.53編譯,安裝配置
Debian4下安裝MySql5.1.53
h2. 編譯
<pre>
./configure '--prefix=/usr/local/mysql5.1.53' '--with-mysqld-user=mysql' '--with-extra-charsets=all' '--with-unix-socket-path=/usr/local/mysql5.1.53/var/mysql.sock' '--with-named-curses-libs=/lib/libncurses.so.5' '--enable-assembler'
</pre>
h2. 安裝
<pre>
make && make install
</pre>
h2. 初始化數(shù)據(jù)庫
剛剛編譯安裝完成的mysql中沒有任何數(shù)據(jù)庫,包括默認(rèn)的mysql數(shù)據(jù)庫,這個需要初始化安裝。
命令如下
<pre>
/usr/local/mysql5.1.53/bin/mysql_install_db
</pre>
h2. 配置
h3. 創(chuàng)建配置文件
我們把/usr/local/mysql5.1.53/share/mysql這個目錄下的my-medium.cnf,復(fù)制為my.cnf到mysql安裝目錄
做如下修改
在[mysqld] 配置塊中加入
skip-name-resolve #取消DNS反向解析,提高遠(yuǎn)程訪問速度
_詳細(xì)內(nèi)容,參考57上的my.cnf吧_
h3. 啟動&停止
* 啟動
<pre>
/usr/local/mysql5.1.53/bin/mysqld_safe --user=root &
</pre>
* 停止
<pre>
/usr/local/mysql5.1.53/share/mysql/mysql.server stop
</pre>
h3. 進入mysql命令行
<pre>
/usr/local/mysql5.1.53/bin/mysql -uroot
</pre>
h3. 開啟遠(yuǎn)程訪問
# 配置cnf文件
找到你的my.cnf文件(如果用debian提供的mysql,在/etc/mysql/my.cnf)
查找 bind-address,等號后邊寫server的IP地址
# 在mysql命令行執(zhí)行下列命令
<pre>
GRANT ALL PRIVILEGES ON *.* TO 'depman'@'%' IDENTIFIED BY 'depman' WITH GRANT OPTION;
</pre>
說明 : 添加depman用戶,密碼為depman,可以在任何遠(yuǎn)程機器訪問數(shù)據(jù)庫且擁有全部權(quán)限
h3. 添加InnoDB支持
# 進入mysql命令行
# mysql> show plugin;
查看是否有InnoDB的支持,沒有的話
# mysql> install plugin innodb soname "ha_innodb.so";
# 再次執(zhí)行mysql> show plugin;發(fā)現(xiàn)有InnoDB,安裝成功
h3. 數(shù)據(jù)移植
* 備份57上的kebin數(shù)據(jù)庫(sql文件)
<pre>
/usr/local/mysql5.1.53/bin/mysqldump --skip-lock-tables -h192.168.12.57 -uroot -proot kebin > kebin.sql
</pre>
* 導(dǎo)入剛才生成的sql文件到kebin數(shù)據(jù)庫
<pre>
/usr/local/mysql5.1.53/bin/mysql kebin < kebin.sql
</pre>
* 從ServerA到ServerB遷移數(shù)據(jù)
<pre>
/usr/local/mysql5.1.53/bin/mysqldump --skip-lock-tables -uroot -proot kebin | /usr/local/mysql5.1.53/bin/mysql -h192.168.12.58 -udepman -pdepman kebin
</pre>