cenos7.6编译安装mariadb

安装依赖包

yum install bison bison-devel zlib-devel libcurl-devel libarchive-devel boostdevel \
gcc gcc-c++ cmake ncurses-devel gnutls-devel libxml2-devel openssl-devel libevent-devel libaio-devel

创建用户

[root@use03 ~]# groupadd -g 666 mysql
[root@use03 ~]# useradd -g 666 -u 666 -r -s /sbin/nologin mysql

准备安装包

[root@use03 ~]# mkdir /tools
[root@use03 tools]# cd /tools/
[root@use03 tools]# tar xf mariadb-10.2.25.tar.gz

生成编译配置

[root@use03 tools]# cd mariadb-10.2.25/
[root@use03 mariadb-10.2.25]# cmake . \
-DCMAKE_INSTALL_PREFIX=/app/mysql \
-DMYSQL_DATADIR=/data/mysql/ \
-DSYSCONFDIR=/etc/ \
-DMYSQL_USER=mysql \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITHOUT_MROONGA_STORAGE_ENGINE=1 \
-DWITH_DEBUG=0 \
-DWITH_READLINE=1 \
-DWITH_SSL=system \
-DWITH_ZLIB=system \
-DWITH_LIBWRAP=0 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci

编译并安装

[root@use03 mariadb-10.2.25]# make && make install

初始化配置

[root@use03 ~]# mkdir -p /data/mysql
[root@use03 ~]# chown -R mysql:mysql /app/mysql/
[root@use03 ~]# chown -R mysql:mysql /data/mysql/
[root@use03 ~]# /app/mysql/scripts/mysql_install_db --datadir=/data/mysql --user=mysql
Installing MariaDB/MySQL system tables in '/data/mysql' ...
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:

'/app/mysql/bin/mysqladmin' -u root password 'new-password'
'/app/mysql/bin/mysqladmin' -u root -h use03 password 'new-password'

Alternatively you can run:
'/app/mysql/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 '/app/mysql' ; /app/mysql/bin/mysqld_safe --datadir='/data/mysql'

You can test the MariaDB daemon with mysql-test-run.pl
cd '/app/mysql/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
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/

启动服务

[root@use03 ~]# /app/mysql/bin/mysqld

你可能感兴趣的:(linux,mariadb)