Ubuntu 10.10裡下載MySQL源碼及編譯安裝

來源:互聯網
上載者:User

第一次在Linux(Ubuntu 10.10)上安裝MySQL,還是費了一些周折,總算基本理清思路了。先說說我最終成功安裝的步驟,即在Ubuntu 10.10裡下載mysql源碼,編譯安裝。

當前mysql版本是5.5.20,我的系統版本是ubuntu 10.10

1下載源碼:

在官方網站,

選擇:MySQL Community Server--download

選擇 sourcecode,前面幾個都是什麼rpm,最後一個是我覺得應該下載的包

Generic Linux (Architecture Independent), Compressed TAR Archive
5.5.20 23.2M Download
(mysql-5.5.20.tar.gz)

 

2下載完成,解壓縮。

裡面有個安裝說明檔案:INSTALL-SOURCE

開啟,裡面這一段是核心安裝步驟:(命令前都加sudo執行!)

# Preconfiguration setup     首先是添加一個使用者組
shell> groupadd mysql
shell> useradd -r -g mysql mysql
# Beginning of source-build specific instructions
shell> tar zxvf mysql-VERSION.tar.gz         解壓縮源碼包
shell> cd mysql-VERSION                          切換到源碼包目錄
shell> cmake .                                            執行cmake,產生mk檔案(沒有cmake,sudo apt-get install cmake)
shell> make                                                 編輯
shell> make install                                       安裝
# End of source-build specific instructions             -----------ok,安裝完成了哦
# Postinstallation setup                                ----下面是配置mysql
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql     ---執行內部mysql安裝(參看紅線下方執行結果)
shell> chown -R root .
shell> chown -R mysql data
# Next command is optional                           --字面意思:下面這個命令可選
shell> cp support-files/my-medium.cnf /etc/my.cnf    複製mysql設定檔
shell> bin/mysqld_safe --user=mysql &                啟動資料庫
# Next command is optional                          --字面意思:下面這個命令可選
shell> cp support-files/mysql.server /etc/init.d/mysql.server   設定自啟動

按照這個就能完整安裝了

3安裝完並且配置完,進去看一下

在/usr/local/mysql 目錄,執行

root@ www.bkjia.com -laptop:/usr/local/mysql#  ./bin/mysql -u root -S /tmp/mysql.sock -p

正常登入,提示:

  1. Server version: 5.5.20-log Source distribution  
  2.   
  3. Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.  
  4.   
  5. Oracle is a registered trademark of Oracle Corporation and/or its  
  6. affiliates. Other names may be trademarks of their respective  
  7. owners.  
  8.   
  9. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.  
  10.   
  11. mysql>  

4官方網站有個gui工具,可以下載試一下:

MySQL Workbench (GUI Tool)

  • 1
  • 2
  • 下一頁

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.