linux下安裝Mysql

來源:互聯網
上載者:User

標籤:

---恢複內容開始---

 linux版本:CentOS7 64位

    1、現在安裝包“mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz”    

    2、把下載的安裝包移動到/usr/local/下。

    3、解壓

tar zxvf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz

    4、添加系統mysql組和mysql使用者

1 groupadd mysql2 useradd -r -g mysql mysql

    5、修改目前的目錄擁有者為mysql使用者

 chown -R mysql:mysql ./

    6、安裝資料庫,此處可能出現錯誤。

./scripts/mysql_install_db --user=mysql

錯誤資訊:./scripts/mysql_install_db: /usr/bin/perl: bad interpreter: No such file or directory

原因:沒有/usr/bin/perl檔案或者檔案。

解決辦法:(安裝perl跟perl-devel即可)

yum -y install perl perl-devel

錯誤資訊:FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:

Data::Dumper

 解決方案 :安裝autoconf庫,此包安裝時會安裝Data:Dumper模組

yum -y install autoconf

    7、修改目前的目錄擁有者為root使用者

chown -R root:root ./

    8、修改當前data目錄擁有者為mysql使用者

chown -R mysql:mysql data

============== 到此資料庫安裝完畢 =============

   9、啟動mysql服務和添加開機啟動mysql服務

添加開機啟動,把啟動指令碼放到開機初始化目錄。

cp support-files/mysql.server /etc/init.d/mysql

    10、啟動mysql服務

service mysql start

錯誤資訊:

/etc/init.d/mysql: line 256: my_print_defaults: command not found
/etc/init.d/mysql: line 276: cd: /usr/local/mysql: No such file or directory
Starting MySQL ERROR! Couldn‘t find MySQL server (/usr/local/mysql/bin/mysqld_safe)

==========

 

 

/usr/local/mysql-5.6.33-linux-glibc2.5-x86_64

 

 

---恢複內容結束---

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.