Linux下安裝mysql的方法詳解

來源:互聯網
上載者:User

標籤:io   ar   strong   資料   art   sp   on   c   linux   

前提:安裝cmake(mysql5.5以後是通過cmake來編譯的)到網路去下載一下吧,安裝方法如下:

[[email protected] soft]#tar -xzvf cmake-2.6.4.tar.gz 

[[email protected] cmake-2.6.4]#./configure --prefix=/usr/local/cmake 

[[email protected] cmake-2.6.4]#make

[[email protected] cmake-2.6.4]#make install

 

#建立使用者和使用者組與賦予資料存放目錄許可權

[[email protected] ~]#groupadd mysql
[[email protected] ~]#useradd -g mysql mysql

#解壓
[[email protected] soft]# tar -zxvf mysql-5.5.29.tar.gz

#安裝mysql
[[email protected] mysql]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql/database -
DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysqld.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -
DMYSQL_TCP_PORT=3306 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -

DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock -DMYSQL_USER=mysql -DWITH_DEBUG=0

(注意:)

   如果cmake時出現 command not found 的字樣時,請在終端執行下面命令

 [[email protected] mysql]# export PATH=/usr/local/cmake/bin:$PATH

   


[[email protected] mysql]# make
[[email protected] mysql]# makeinstall

#設定許可權
[[email protected] mysql]#chown -R mysql:mysql /usr/local/mysql/

#初始化mysqldb
[[email protected] mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/database

#設定資料庫許可權:
[[email protected] mysql]# chown mysql:mysql -R /data/mysql/database

 

#配置mysql

[[email protected] support-files]# cp my-large.cnf /etc/my.cnf
[[email protected] support-files]# cp mysql.server /etc/init.d/mysqld
[[email protected] support-files]# chmod +x /etc/init.d/mysqld

 

#啟動mysql

[[email protected] ~]# /etc/init.d/mysqld start

#串連資料庫

[[email protected] mysql]# /usr/local/mysql/bin/mysql -u root -p

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.