MariaDB 10.1源码安装流程(CentOS 6.5) 超、凢脫俗 2024-04-18 00:13 11阅读 0赞 **--安装所需软件包** \[root@localhost mariadb-10.1.14\]\# yum install bison bison-devel ncurses libxml2 libxml2-devel 下载新版本的cmake工具 \[root@localhost install\]\# wget https://cmake.org/files/v3.5/cmake-3.5.2.tar.gz --no-check-certificate \--2016-06-17 05:21:22-- https://cmake.org/files/v3.5/cmake-3.5.2.tar.gz Resolving cmake.org... 66.194.253.19 Connecting to cmake.org|66.194.253.19|:443... connected. WARNING: certificate common name “\*.kitware.com” doesn’t match requested host name “cmake.org”. HTTP request sent, awaiting response... 200 OK Length: 6863498 (6.5M) \[application/x-gzip\] Saving to: “cmake-3.5.2.tar.gz” 100%\[===================================================================================================================>\] 6,863,498 137K/s in 65s 2016-06-17 05:22:35 (104 KB/s) - “cmake-3.5.2.tar.gz” saved \[6863498/6863498\] \[root@localhost install\]\# tar fxvz cmake-3.5.2.tar.gz \[root@localhost install\]\# cd cmake-3.5.2 \[root@localhost cmake-3.5.2\]\# ./bootstrap 编译安装cmake3.5.2 \[root@localhost cmake-3.5.2\]\# make ..... \[ 98%\] Building C object Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeFiles/pseudonl\_BC.dir/ret0.c.o \[ 99%\] Linking C executable BC \[ 99%\] Built target pseudonl\_BC Scanning dependencies of target pseudonl\_purify \[ 99%\] Building C object Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeFiles/pseudonl\_purify.dir/ret0.c.o \[ 99%\] Linking C executable purify \[ 99%\] Built target pseudonl\_purify Scanning dependencies of target pseudonl\_valgrind \[ 99%\] Building C object Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeFiles/pseudonl\_valgrind.dir/ret0.c.o \[ 99%\] Linking C executable valgrind \[ 99%\] Built target pseudonl\_valgrind Scanning dependencies of target pseudo\_emulator \[ 99%\] Building C object Tests/RunCMake/CMakeFiles/pseudo\_emulator.dir/pseudo\_emulator.c.o \[ 99%\] Linking C executable pseudo\_emulator \[ 99%\] Built target pseudo\_emulator Scanning dependencies of target pseudo\_iwyu \[100%\] Building C object Tests/RunCMake/CMakeFiles/pseudo\_iwyu.dir/pseudo\_iwyu.c.o \[100%\] Linking C executable pseudo\_iwyu \[100%\] Built target pseudo\_iwyu Scanning dependencies of target foo \[100%\] Building CXX object Tests/FindPackageModeMakefileTest/CMakeFiles/foo.dir/foo.cpp.o \[100%\] Linking CXX static library libfoo.a \[100%\] Built target foo \[root@localhost cmake-3.5.2\]\# make install ..... \-- Installing: /usr/local/bin/ccmake \-- Installing: /usr/local/bin/cmake \-- Installing: /usr/local/bin/ctest \-- Installing: /usr/local/bin/cpack \-- Installing: /usr/local/share/cmake-3.5/include/cmCPluginAPI.h \-- Installing: /usr/local/share/cmake-3.5/editors/vim/cmake-help.vim \-- Installing: /usr/local/share/cmake-3.5/editors/vim/cmake-indent.vim \-- Installing: /usr/local/share/cmake-3.5/editors/vim/cmake-syntax.vim \-- Installing: /usr/local/share/cmake-3.5/editors/emacs/cmake-mode.el \-- Installing: /usr/local/share/aclocal/cmake.m4 \-- Installing: /usr/local/share/cmake-3.5/completions/cmake \-- Installing: /usr/local/share/cmake-3.5/completions/cpack \-- Installing: /usr/local/share/cmake-3.5/completions/ctest \--查看cmake的版本 \[root@localhost cmake-3.5.2\]\# cmake --version cmake version 3.5.2 CMake suite maintained and supported by Kitware (kitware.com/cmake). **--下载** **MariaDB 10.1** **源码包** \[root@localhost install\]\# wget http://mirrors.tuna.tsinghua.edu.cn/mariadb//mariadb-10.1.14/source/mariadb-10.1.14.tar.gz \--2016-06-15 23:47:38-- http://mirrors.tuna.tsinghua.edu.cn/mariadb//mariadb-10.1.14/source/mariadb-10.1.14.tar.gz Resolving mirrors.tuna.tsinghua.edu.cn... 166.111.206.63, 2402:f000:1:416:166:111:206:63 Connecting to mirrors.tuna.tsinghua.edu.cn|166.111.206.63|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 55341017 (53M) \[application/octet-stream\] Saving to: “mariadb-10.1.14.tar.gz” 100%\[===================================================================================================================>\] 55,341,017 576K/s in 64s 2016-06-15 23:48:44 (843 KB/s) - “mariadb-10.1.14.tar.gz” saved \[55341017/55341017\] \[root@localhost install\]\# tar -zxvf mariadb-10.1.14.tar.gz \[root@localhost install\]\# cd mariadb-10.1.14 \[root@localhost mariadb-10.1.14\]\# ls BUILD config.h.cmake CREDITS extra libmysql mysys README storage VERSION BUILD-CMAKE configure.cmake dbug include libmysqld mysys\_ssl scripts strings vio client COPYING debian INSTALL-SOURCE libservices pcre sql support-files win cmake COPYING.LESSER Docs INSTALL-WIN-SOURCE man plugin sql-bench tests wsrep CMakeLists.txt COPYING.thirdparty EXCEPTIONS-CLIENT KNOWN\_BUGS.txt mysql-test randgen sql-common unittest zlib **--创建MariaDB软件** **安装目录、数据文件和日志文件目录** \[root@localhost storage\]\# mkdir /maria \[root@localhost storage\]\# mkdir -p /maria\_data/cnf \[root@localhost maria\_data\]\# mkdir -p /log/maria \[root@localhost maria\_data\]\# chown -R mysql:mysql /log/maria/ **--开始编译安装** \[root@localhost mariadb-10.1.14\]\# **cmake . -DCMAKE\_INSTALL\_PREFIX=/maria \\** \-DDEFAULT\_CHARSET=utf8 \\ \-DDEFAULT\_COLLATION=utf8\_general\_ci \\ \-DENABLED\_LOCAL\_INFILE=ON \\ \-DWITH\_XTRADB\_STORAGE\_ENGINE=1 \\ \-DWITH\_MYISAM\_STORAGE\_ENGINE=1 \\ \-DWITH\_INNOBASE\_STORAGE\_ENGINE=1 \\ \-DWITH\_FEDERATEDX\_STORAGE\_ENGINE=1 \\ \-DWITH\_PARTITION\_STORAGE\_ENGINE=1 \\ \-DWITH\_PERFSCHEMA\_STORAGE\_ENGINE=1 \\ \-DCOMPILATION\_COMMENT='MariaDB 10.1 production environment' \\ \-DWITH\_READLINE=ON \\ \-DSYSCONFDIR=/maria\_data/cnf \\ \-DMYSQL\_UNIX\_ADDR=/maria\_data/maria.sock \\ \-DMYSQL\_DATADIR=/maria\_data \-- Running cmake version 3.5.2 \-- MariaDB 10.1.14 \-- Packaging as: mariadb-10.1.14-Linux-x86\_64 \-- OPENSSL\_INCLUDE\_DIR = /usr/include \-- OPENSSL\_LIBRARIES = /usr/lib64/libssl.so \-- CRYPTO\_LIBRARY = /usr/lib64/libcrypto.so \-- OPENSSL\_MAJOR\_VERSION = 1 \-- SSL\_LIBRARIES = /usr/lib64/libssl.so;/usr/lib64/libcrypto.so;dl \-- Checking for one of the modules 'libsystemd;libsystemd-daemon' \-- Systemd features not enabled \-- Found LibXml2: /usr/lib64/libxml2.so (found version "2.7.6") \-- Configuring done \-- Generating done \-- Build files have been written to: /install/mariadb-10.1.14 \[root@localhost mariadb-10.1.14\]\# **make** ..... Scanning dependencies of target bug25714 \[100%\] Building C object tests/CMakeFiles/bug25714.dir/bug25714.c.o \[100%\] Linking CXX executable bug25714 \[100%\] Built target bug25714 Scanning dependencies of target mysql\_client\_test \[100%\] Building C object tests/CMakeFiles/mysql\_client\_test.dir/mysql\_client\_test.c.o \[100%\] Linking CXX executable mysql\_client\_test \[100%\] Built target mysql\_client\_test Scanning dependencies of target mysqld \[100%\] Building CXX object sql/CMakeFiles/mysqld.dir/main.cc.o \[100%\] Linking CXX executable mysqld \[100%\] Built target mysqld Scanning dependencies of target udf\_example \[100%\] Building C object sql/CMakeFiles/udf\_example.dir/udf\_example.c.o \[100%\] Linking C shared module udf\_example.so \[100%\] Built target udf\_example Scanning dependencies of target mysql\_tzinfo\_to\_sql \[100%\] Building CXX object sql/CMakeFiles/mysql\_tzinfo\_to\_sql.dir/tztime.cc.o \[100%\] Linking CXX executable mysql\_tzinfo\_to\_sql \[100%\] Built target mysql\_tzinfo\_to\_sql Scanning dependencies of target my\_safe\_process \[100%\] Building CXX object mysql-test/lib/My/SafeProcess/CMakeFiles/my\_safe\_process.dir/safe\_process.cc.o \[100%\] Linking CXX executable my\_safe\_process \[100%\] Built target my\_safe\_process \[root@localhost mariadb-10.1.14\]\# **make install** ..... \-- Installing: /maria/bin/mytop \-- Installing: /maria/bin/mysqlhotcopy \-- Installing: /maria/bin/mysqldumpslow \-- Installing: /maria/bin/mysqld\_multi \-- Installing: /maria/bin/mysqld\_safe \-- Installing: /maria/bin/wsrep\_sst\_common \-- Installing: /maria/bin/wsrep\_sst\_mysqldump \-- Installing: /maria/bin/wsrep\_sst\_rsync \-- Installing: /maria/bin/wsrep\_sst\_xtrabackup \-- Installing: /maria/bin/wsrep\_sst\_xtrabackup-v2 \-- Installing: /maria/share/maria\_add\_gis\_sp.sql \-- Installing: /maria/share/maria\_add\_gis\_sp\_bootstrap.sql \-- Installing: /maria/support-files/my-huge.cnf \-- Installing: /maria/support-files/my-innodb-heavy-4G.cnf \-- Installing: /maria/support-files/my-large.cnf \-- Installing: /maria/support-files/my-medium.cnf \-- Installing: /maria/support-files/my-small.cnf \-- Installing: /maria/support-files/wsrep.cnf \-- Installing: /maria/support-files/mysqld\_multi.server \-- Installing: /maria/support-files/mysql-log-rotate \-- Installing: /maria/support-files/binary-configure \-- Installing: /maria/support-files/wsrep\_notify \-- Installing: /maria/support-files/magic \-- Installing: /maria/support-files/policy \-- Installing: /maria/support-files/policy/apparmor \-- Installing: /maria/support-files/policy/apparmor/usr.sbin.mysqld \-- Installing: /maria/support-files/policy/apparmor/README \-- Installing: /maria/support-files/policy/apparmor/usr.sbin.mysqld.local \-- Installing: /maria/support-files/policy/selinux \-- Installing: /maria/support-files/policy/selinux/mariadb-server.te \-- Installing: /maria/support-files/policy/selinux/README \-- Installing: /maria/support-files/policy/selinux/mariadb-server.fc \-- Installing: /maria/share/pkgconfig/mariadb.pc \-- Installing: /maria/share/aclocal/mysql.m4 \-- Installing: /maria/support-files/mysql.server **--更改MariaDB数据文件的权限为mysql** \[root@localhost cnf\]\# chown -R mysql:mysql /maria\_data/ **--创建MySQL数据库的系统表** \[root@localhost maria\]\# /maria/scripts/mysql\_install\_db --user=mysql --datadir=/maria\_data/ ..... 2016-06-17 17:37:16 139707541080032 \[Note\] InnoDB: Highest supported file format is Barracuda. 2016-06-17 17:37:16 139707541080032 \[Note\] InnoDB: 128 rollback segment(s) are active. 2016-06-17 17:37:16 139707541080032 \[Note\] InnoDB: Waiting for purge to start 2016-06-17 17:37:16 139707541080032 \[Note\] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.29-76.2 started; log sequence number 1616819 2016-06-17 17:37:16 139706685712128 \[Note\] InnoDB: Dumping buffer pool(s) not yet started OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER ! To do so, start the server, then issue the following commands: './bin/mysqladmin' -u root password 'new-password' './bin/mysqladmin' -u root -h localhost.localdomain password 'new-password' Alternatively you can run: './bin/mysql\_secure\_installation' which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the MariaDB Knowledgebase at http://mariadb.com/kb or the MySQL manual for more instructions. You can start the MariaDB daemon with: cd '.' ; ./bin/mysqld\_safe --datadir='/maria\_data/' You can test the MariaDB daemon with mysql-test-run.pl cd './mysql-test' ; perl mysql-test-run.pl Please report any problems at http://mariadb.org/jira The latest information about MariaDB is available at http://mariadb.org/. You can find additional information about the MySQL part at: http://dev.mysql.com Support MariaDB development by buying support/new features from MariaDB Corporation Ab. You can contact us about this at sales@mariadb.com. Alternatively consider joining our community based development effort: http://mariadb.com/kb/en/contributing-to-the-mariadb-project/ **--拷贝配置文件模板到配置文件目录** \[root@localhost maria\]\# cp ./support-files/my-medium.cnf /maria\_data/cnf/my.cnf **--启动数据库** \[root@localhost maria\]\# ./bin/mysqld\_safe --defaults-file=/maria\_data/cnf/my.cnf & \[1\] 14633 \[root@localhost maria\]\# 160617 18:55:09 mysqld\_safe Logging to '/log/maria/err.log'. 160617 18:55:09 mysqld\_safe Starting mysqld daemon with databases from /maria\_data **--修改root用户密码** \[root@localhost maria\]\# ./bin/mysqladmin -uroot password 'root' **--连接数据库** \[root@localhost maria\]\# ./bin/mysql -uroot -p'root' Welcome to the MariaDB monitor. Commands end with ; or \\g. Your MariaDB connection id is 6 Server version: 10.1.14-MariaDB MariaDB 10.1 production environment Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement. MariaDB \[(none)\]> show databases; \+--------------------+ | Database | \+--------------------+ | cnf | | information\_schema | | mysql | | performance\_schema | | test | \+--------------------+ 5 rows in set (0.00 sec) MariaDB \[(none)\]> use test Database changed MariaDB \[test\]> show tables; Empty set (0.00 sec) MariaDB \[test\]> create table test(a int); Query OK, 0 rows affected (0.08 sec) MariaDB \[test\]> show create table test; \+-------+---------------------------------------------------------------------------------------+ | Table | Create Table | \+-------+---------------------------------------------------------------------------------------+ | test | CREATE TABLE \`test\` ( \`a\` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 | \+-------+---------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) MariaDB \[test\]> insert into test values(100); Query OK, 1 row affected (0.00 sec) MariaDB \[test\]> select \* from test; \+------+ | a | \+------+ | 100 | \+------+ 1 row in set (0.00 sec) MariaDB \[test\]> show engines; \+--------------------+---------+--------------------------------------------------------------------------------------------------+--------------+------+------------+ | Engine | Support | Comment | Transactions | XA | Savepoints | \+--------------------+---------+--------------------------------------------------------------------------------------------------+--------------+------+------------+ | MRG\_MyISAM | YES | Collection of identical MyISAM tables | NO | NO | NO | | MyISAM | YES | MyISAM storage engine | NO | NO | NO | | CSV | YES | CSV storage engine | NO | NO | NO | | FEDERATED | YES | FederatedX pluggable storage engine | YES | NO | YES | | MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO | | Aria | YES | Crash-safe tables with MyISAM heritage | NO | NO | NO | | PERFORMANCE\_SCHEMA | YES | Performance Schema | NO | NO | NO | | InnoDB | DEFAULT | Percona-XtraDB, Supports transactions, row-level locking, foreign keys and encryption for tables | YES | YES | YES | | SEQUENCE | YES | Generated tables filled with sequential values | YES | NO | YES | \+--------------------+---------+--------------------------------------------------------------------------------------------------+--------------+------+------------+ 9 rows in set (0.00 sec) 来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26506993/viewspace-2120403/,如需转载,请注明出处,否则将追究法律责任。 转载于:http://blog.itpub.net/26506993/viewspace-2120403/
还没有评论,来说两句吧...