使用cmake編譯安裝MySQL 5.5

來源:互聯網
上載者:User

標籤:mysql 編譯安裝

  1. 首先將cmake-2.8.8.tar.gz、mysql-5.5.32.tar.gz源碼包上傳至伺服器。

  2. 解壓並安裝cmake

[[email protected] ~]# tar -zxvf cmake-2.8.8.tar.gz [[email protected] ~]# cd cmake-2.8.8[[email protected] cmake-2.8.8]# ./configure ......-- Configuring done-- Generating done-- Build files have been written to: /root/cmake-2.8.8---------------------------------------------CMake has bootstrapped.  Now run gmake.

確保cmake沒有錯誤發生

[[email protected] cmake-2.8.8]# echo $?0

下面運行gmake命令

[[email protected] cmake-2.8.8]# gmake [[email protected] cmake-2.8.8]# gmake install

3. 安裝MySQL依賴表ncurses-devel

[[email protected] cmake-2.8.8]# yum install ncurses-devel -y

4. 建立mysql使用者

[[email protected] cmake-2.8.8]# groupadd mysql        [[email protected] cmake-2.8.8]# useradd mysql -s /sbin/nologin -M -g mysql

5. 解壓編譯MySQL 

[[email protected] ~]# cd ..[[email protected] ~]# tar -zxvf mysql-5.5.32.tar.gz [[email protected] ~]# cd mysql-5.5.32[[email protected] mysql-5.5.32]#  cmake -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32   -DMYSQL_DATADIR=/application/mysql-5.5.32/data   -DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/tmp/mysql.sock   -DDEFAULT_CHARSET=utf8   -DDEFAULT_COLLATION=utf8_general_ci   -DWITH_EXTRA_CHARSETS=all   -DWITH_INNOBASE_STORAGE_ENGINE=1   -DWITH_ARCHIVE_STORAGE_ENGINE=1   -DWITH_BLACKHOLE_STORAGE_ENGINE=1   -DWITH_PERFSCHEMA_STORAGE_ENGINE=1   -DWITH_SSL=yes    -DENABLED_LOCAL_INFILE=1
[[email protected] mysql-5.5.32]# make && make install

為安裝目錄做一個link

[[email protected] mysql-5.5.32]# ln -s /application/mysql-5.5.32/ /application/mysql

將原始碼目錄中的設定檔copy到/etc目錄下

[[email protected] mysql-5.5.32]# cp support-files/my-small.cnf /etc/my.cnf

6. 配置環境變數

[[email protected] mysql-5.5.32]# echo ‘export PATH=/application/mysql/bin:$PATH‘ >> /etc/profile

7. 授權mysql使用者訪問安裝目錄

[[email protected] mysql]# chown mysql.mysql -R /application/mysql

8. 初始化mysql資料庫

[[email protected] scripts]# ./mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysqlInstalling MySQL system tables...OKFilling help tables...OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands:/application/mysql/bin/mysqladmin -u root password ‘new-password‘/application/mysql/bin/mysqladmin -u root -h localhost.localdomain password ‘new-password‘Alternatively you can run:/application/mysql/bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default.  This isstrongly recommended for production servers.See the manual for more instructions.You can start the MySQL daemon with:cd /application/mysql ; /application/mysql/bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.plcd /application/mysql/mysql-test ; perl mysql-test-run.plPlease report any problems with the /application/mysql/scripts/mysqlbug script!


9. 製作mysql啟動指令碼

[[email protected] mysql-5.5.32]# cp support-files/mysql.server /etc/init.d/mysqld

10 啟動mysql

[[email protected] mysql-5.5.32]# /etc/init.d/mysqld startStarting MySQL..                                           [  OK  ]


本文出自 “叮咚” 部落格,請務必保留此出處http://lqding.blog.51cto.com/9123978/1726005

使用cmake編譯安裝MySQL 5.5

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.