centos 編譯安裝mysql

來源:互聯網
上載者:User

標籤:des   style   blog   http   color   使用   os   strong   

一.mysql5.5.38:http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.38.tar.gz

二.原出處:http://1567045.blog.51cto.com/1557045/841064

三.簡單回顧:

0.準備磁碟,存放mysql的data檔案

安裝如果磁碟大於2t,需要安裝parted,yum search parted   yum install xx

  • fdisk –l  先查看分區,確定要分的盤符 比如dev/sda
  • 進入parted
  • parted /dev/sda
  • makde label
(parted) mklabel gpt                                                     Warning: The existing disk label on /dev/sda will be destroyed and all data onthis diskwill be lost. Do you want to continue?Yes/No? yes
  • make part
(parted) mkpartPartition name? []? dp1File system type? [ext2]? ext3Start? 0End? 500GB或者0%  100%
  • 查看
(parted) print
  • 刪除
rm 1 #rm後面使用分區的號碼
  • 格式化
quit 退出parted使用系統的mkfs.ext3 /dev/hdd1
  • 掛載
# mount /dev/hdd2 /dp2  dp2需要建立檔案夾 makedir -pv /dp2
  • 開機自動掛載的設定,上一個設定,重啟電腦後,會取消掛載
  • vim /etc/fstab最後一行加入類似這種/dev/sdb2               /media/Bak2                             ext4    defaults        0 0

1.安裝所需依賴:

yum -y install ntp vim-enhanced gcc gcc-c++ flex bison autoconf automake bzip2-devel ncurses-devel zlib-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel libXpm-devel gettext-devel  pam-devel libtool libtool-ltdl openssl openssl-devel fontconfig-devel libxml2-devel curl-devel  libicu libicu-devel libmcrypt libmcrypt-devel libmhash libmhash-devel

2.安裝cmake

#下載Cmake的源碼包wget http://www.cmake.org/files/v2.8/cmake-2.8.7.tar.gz#編譯安裝tar zxvf cmake-2.8.7.tar.gzcd cmake-2.8.7./configuremake && make install

3.建立 data檔案夾,及建立mysql使用者

#建立所需目錄mkdir -pv /usr/local/mysql/data#建立mysql使用者和mysql組groupadd mysqluseradd -g mysql -s /usr/sbin/nologin mysql
4.
#解壓源碼包tar zxvf mysql-5.5.22.tar.gzcd mysql-5.5.22#cmake編譯cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_unicode_ci -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_DEBUG=0#安裝make && make install#複製設定檔cp support-files/my-medium.cnf /etc/my.cnf#設定許可權chmod +x /usr/local/mysqlchown -R mysql:mysql /usr/local/mysqlchown -R mysql:mysql /usr/local/mysql/data#配置開機自動啟動cp support-files/mysql.server /etc/init.d/mysqldchmod +x /etc/init.d/mysqldchkconfig --add mysqldchkconfig mysqld on#修改設定檔vim /etc/my.cnf#在[mysqld]中添加:datadir = /usr/local/mysql/datalog-error = /usr/local/mysql/data/error.logpid-file = /usr/local/mysql/data/mysql.piduser = mysqltmpdir = /tmp#儲存退出#初始化資料庫/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data#手動啟動MySQLservice mysqld start#測試MySQL是否啟動#查看是否有mysql進程ps -ef | grep mysql#查看是否有mysql連接埠netstat -tnlp | grep 3306#添加mysql的軟連結可以使用使用者直接使用ln -sv /usr/local/mysql/bin/mysql mysqlln -sv /usr/local/mysql/bin/mysqladmin mysqladminln -sv /usr/local/mysql/bin/mysqldump mysqldump或者編輯/etc/profile在以PATH開頭的上一行添加PATH=$PATH:/usr/local/mysql/bin#重讀/etc/profile檔案. /etc/profile#測試mysql,mysqladmin,mysqldump命令是否能正常使用#讀取MySQL的版本資訊mysqladmin version
相關文章

聯繫我們

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