天天看點

MySQL 5.5.8安裝詳細步驟

MySQL 5.5.8安裝詳細筆記

一、下載下傳源碼包到本地

<a target="_blank" href="http://blog.51cto.com/attachment/201101/191314822.png"></a>

二、安裝cmake

1)解壓

<a target="_blank" href="http://blog.51cto.com/attachment/201101/191342807.png"></a>

2)安裝

<a target="_blank" href="http://blog.51cto.com/attachment/201101/191422688.png"></a>

三、安裝MySQL

1) 解壓

<a href="http://blog.51cto.com/attachment/201101/191731459.png" target="_blank"></a>

 2)安裝前準備

安裝及啟動資料庫是以mysql使用者進行的,首先檢視系統中有沒有mysql這個使用者

<a href="http://blog.51cto.com/attachment/201101/192110626.png" target="_blank"></a>

如沒有則利用如下指令建立

<a href="http://blog.51cto.com/attachment/201101/192134972.png" target="_blank"></a>

準确就緒,安裝

<a href="http://blog.51cto.com/attachment/201101/192402839.png" target="_blank"></a>

安裝

<a href="http://blog.51cto.com/attachment/201101/192553712.png" target="_blank"></a>

 安裝後操作

1)改變安裝目錄屬性

<a target="_blank" href="http://blog.51cto.com/attachment/201101/195839526.png"></a>

2)copy相應檔案到指定位置

<a target="_blank" href="http://blog.51cto.com/attachment/201101/195910367.png"></a>

我是虛拟機測試,随便copy了一樣配置檔案,你安裝的時候可以按照具體需求來做

注:下面的兩個檔案最好是/usr/local/mysql/support-files目錄下,我看有的人是在源碼包下support-files目錄copy的,如果這樣,會有一點小問題,需要自行修改,而copy /usr/local/mysql/support-files目錄下就沒啥問題

<a target="_blank" href="http://blog.51cto.com/attachment/201101/195945397.png"></a>

3)配置mysql 服務

<a target="_blank" href="http://blog.51cto.com/attachment/201101/200234958.png"></a>

4)接着生成系統預設的mysql資料庫

<a target="_blank" href="http://blog.51cto.com/attachment/201101/200322402.png"></a>

如果你是按照上面的指令運作,會出現這麼一條錯誤

<a target="_blank" href="http://blog.51cto.com/attachment/201101/200421470.png"></a>

正确的指令應該是

<a target="_blank" href="http://blog.51cto.com/attachment/201101/200520738.png"></a>

如下提示,表示正确

<a target="_blank" href="http://blog.51cto.com/attachment/201101/200650350.png"></a>

5)啟動MySQL服務

<a target="_blank" href="http://blog.51cto.com/attachment/201101/200805358.png"></a>

出現上面的錯誤,怎麼辦?

修改一下/etc/init.d/mysql啟動腳本,在basedir、datadir處添加實際路徑即可

<a target="_blank" href="http://blog.51cto.com/attachment/201101/200929771.png"></a>

再啟動試試,OK

<a target="_blank" href="http://blog.51cto.com/attachment/201101/201010565.png"></a>

 四、安裝後的後續操作

配置環境變量

<a href="http://blog.51cto.com/attachment/201101/202225384.png" target="_blank"></a>

設定mysql root密碼

<a href="http://blog.51cto.com/attachment/201101/202017681.png" target="_blank"></a>

mysql 5.5.8設定密碼後,不能立即生效,是以要reload一下下,之前的5.1版就可以

<a href="http://blog.51cto.com/attachment/201101/202249540.png" target="_blank"></a>

驗證一下

<a href="http://blog.51cto.com/attachment/201101/202320335.png" target="_blank"></a>

OK,至此安裝完畢,以上設定資料庫密碼的操作還可用以下指令代替

<a target="_blank" href="http://blog.51cto.com/attachment/201101/203355931.png"></a>

謝謝大家!

本文轉自dongfang_09859 51CTO部落格,原文連結:http://blog.51cto.com/hellosa/487922,如需轉載請自行聯系原作者