CentOS 7 源碼編譯MariaDB

來源:互聯網
上載者:User

標籤:下載   system   ora   config   general   iso   this   著作權   ml2   

下載源碼包

                                                                                                                                                                                    安裝devtoolset-7

MariaDB 編譯 TokuDB 引擎時會用到 C++11 標準,系統裡 GCC 最高版本 4.8.5 是支援 C++11 標準的,可就算指定了 -DCMAKE_CXX_FLAGS=-std=c++11 也不行。手動編譯更高版本的 GCC 又太麻煩,這裡直接安裝了 devtoolset-7,當然你禁用 TokuDB 引擎也無可厚非

[[email protected] ~]# yum -y install centos-release-scl devtoolset-7[[email protected] ~]# gcc --versiongcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)Copyright ? 2015 Free Software Foundation, Inc.本程式是自由軟體;請參看原始碼的著作權聲明。本軟體沒有任何擔保;包括沒有適銷性和某一專用目的下的適用性擔保。[[email protected] ~]# scl enable devtoolset-7 bash[[email protected] ~]# gcc --versiongcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)Copyright (C) 2017 Free Software Foundation, Inc.This is free software; see the source for copying conditions.  There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                                                      

安裝依賴包

# 安裝依賴包[[email protected] ~]# yum install -y gnutls-devel gcc gcc-c++ cmake ncurses-devel bison-devel bison libaio-devel libevent libxml2-devel# 建立mysql使用者和組[[email protected] ~]# useradd -M -s /sbin/nologin mysql# 建立資料庫資料存放目錄[[email protected] ~]# mkdir /mydata/mariadb/ -p[[email protected] ~]# chown -R mysql.mysql  /mydata# 解壓、編譯、安裝mariadb[[email protected] ~]# tar xf tar mariadb-10.3.7.tar.gz -C /usr/src/[[email protected] ~]# cd /usr/src/mmariadb-10.3.7/[[email protected] mariadb-10.3.7]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql       -DMYSQL_UNIX_ADDR=/tmp/mysql.sock       -DMYSQL_DATADIR=/mydata/mariadb       -DSYSCONFDIR=/etc       -DMYSQL_USER=mysql       -DMYSQL_TCP_PORT=3306       -DWITH_XTRADB_STORAGE_ENGINE=1       -DWITH_INNOBASE_STORAGE_ENGINE=1       -DWITH_PARTITION_STORAGE_ENGINE=1       -DWITH_BLACKHOLE_STORAGE_ENGINE=1       -DWITH_MYISAM_STORAGE_ENGINE=1       -DWITH_READLINE=1       -DENABLED_LOCAL_INFILE=1       -DWITH_EXTRA_CHARSETS=all       -DDEFAULT_CHARSET=utf8       -DDEFAULT_COLLATION=utf8_general_ci       -DEXTRA_CHARSETS=all       -DWITH_BIG_TABLES=1       -DWITH_DEBUG=0  && make -j4 && make -j4 install

初始化安裝資料庫

[[email protected] mariadb-10.3.7]# cd /usr/local/mysql/[[email protected] mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/  --datadir=/mydata/mariadb/[[email protected] mysql]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mariadb[[email protected] mysql]# chmod +x /etc/init.d/mariadb[[email protected] mysql]# chkconfig --add mariadb
[[email protected] mysql]# ln -s /usr/local/mysql/bin* /usr/local/bin

配置mariadb設定檔

[[email protected] mysql]# vim /etc/my.cnf# 只修改這兩項datadir=/mydata/mariadbsocket=/tmp/mysql.sock

啟動mariadb資料庫服務

[[email protected] mysql]# systemctl start  mariadb# mysql_secure_installation 用來修改密碼、刪除匿名使用者、取消遠程連結[[email protected] mysql]# mysql_secure_installation 

 配置完成後就可以用mysql命令使用mariadb了

                                                                                                                                                                                                                                                                              

 

CentOS 7 源碼編譯MariaDB

相關文章

聯繫我們

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