linux下安裝mysql資料庫

來源:互聯網
上載者:User

標籤:

到官網下載
  • mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz

    添加mysql組和mysql使用者,用於設定mysql安裝目錄檔案所有者和所屬組
  • groupadd mysql

  • useradd -r -g mysql mysql

    將二進位檔案解壓到指定的安裝目錄,我們這裡指定為/usr/local
  • cd/usr/local/

  • tar zxvf mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz

    名字太長建立軟串連
  • ln -s mysql-5.6.12-linux-glibc2.5-x86_64 mysql

    進入mysql檔案夾,也就是mysql所在的目錄,並更改所屬的組和使用者。
  • cd mysql

  • chown -R mysql .

  • chgrp -R mysql

    執行mysql_install_db指令碼
  • scripts/mysql_install_db --user=mysql

    將mysql/目錄下除了data/目錄的所有檔案,改回root使用者所有,mysql使用者只需作為mysql/data/目錄下所有檔案的所有者。
  • chown -R root .

  • chown -R mysql data

    複製設定檔
  • cp support-files/my-medium.cnf /etc/my.cnf

    將mysqld服務加入開機自啟動項
  • cp support-files/mysql.server /etc/init.d/mysqld

    通過chkconfig命令將mysqld服務加入到自啟動服務項中。
  • chkconfig --add mysqld

    查看是否添加成功
  • chkconfig --list mysqld

    手動啟動。
  • service mysqld start

遠程無法串連的問題
進入到bin目錄:
./mysql -u root -p
輸入密碼
然後執行:use mysql

授權:GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘36.34.90.248‘ IDENTIFIED BY ‘mypassword‘ WITH GRANT OPTION;


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.