Ubuntu Linux上安裝配置Mysql

來源:互聯網
上載者:User

標籤:style   blog   http   color   io   os   ar   使用   for   

一、安裝:

三種安裝方式:

  1. 從網上安裝 sudo apt-get install mysql-server。裝完已經自動設定好環境變數,可以直接使用mysql的命令。

    註:建議將/etc/apt/source.list中的cn改成us,美國的伺服器比中國的快很多。

經測試,總是串連不成功。最後直接到官網下載MySQL APT Repository (mysql-apt-config_0.2.1-1ubuntu14.04_all.deb),然後安裝,可以成功,網址:http://dev.mysql.com/downloads/repo/apt/

然後執行以下命令:

 1 #1、根據不同版本linux,不同包  2 #For example, for version 1.5 of the package for Debian 7.0, the command is: 3 sudo dpkg -i mysql-apt-config_0.1.5-1debian7_all.deb  4 #For version 1.5 of the package for Ubuntu 12.04 LTS, the command is: 5 sudo dpkg -i mysql-apt-config_0.1.5-1ubuntu12.04_all.deb   6 #For version 1.5 of the package for Ubuntu 14.04 LTS, the command is: 7 sudo dpkg -i mysql-apt-config_0.1.5-1ubuntu14.04_all.deb  8  9 #2、更新10 sudo apt-get update11 12 #3、安裝13 sudo apt-get install mysql-server

 

  2. 安裝離線包,以mysql-5.0.45-linux-i686-icc-glibc23.tar.gz為例。

  3. 二進位包安裝:安裝完成已經自動設定好環境變數,可以直接使用mysql命令

網上安裝和二進位包安裝比較簡單,重點說安裝離線包。

  1. groupadd mysql

  2. mkdir /home/mysql

  3. useradd -g mysql -d /home/mysql mysql

  4. copy mysql-5.0.45-linux-i686-icc-glibc23.tar.gz到/usr/local目錄

  5. 解壓:tar zxvf mysql-5.0.45-linux-i686-icc-glibc23.tar.gz

  6. ln -s mysql-5.0.45-linux-i686-icc-glibc23 mysql

  7. cd /usr/local/mysql

  8. chown -R mysql .

  9. chgrp -R mysql .

  10. scripts/mysql_install_db --user=mysql (一定要在mysql目錄下執行,注意輸出的文字,裡邊有修改root密碼和啟動mysql的命令)

  11. 為root設定密碼: ./bin/mysqladmin -u root password ‘passw0rd‘

Ubuntu Linux上安裝配置Mysql

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.