当前位置: 代码迷 >> 综合 >> MariaDB-5.5.33a 编译安装
  详细解决方案

MariaDB-5.5.33a 编译安装

热度:40   发布时间:2023-12-08 21:40:16.0

交代一下内核的信息

[root@localhost soft]# uname -r

2.6.32-71.el6.x86_64


创建mariadb用户组

[root@localhost mariadb-5.5.33a]# groupadd mariadb
[root@localhost mariadb-5.5.33a]# useradd -s /sbin/nologin -g mariadb mariadb


下载mariadb

[root@localhost soft]# wget http://mirrors.scie.in/mariadb/mariadb-5.5.33a/kvm-tarbake-jaunty-x86/mariadb-5.5.33a.tar.gz

[root@localhost soft]# ls
mariadb-5.5.33a.tar.gz

[root@localhost soft]# tar xf mariadb-5.5.33a.tar.gz -C /usr/src/

[root@localhost src]# cd mariadb-5.5.33a/
[root@localhost mariadb-5.5.33a]# ls
BUILD               config.h.cmake   randgen
BUILD-CMAKE         configure.cmake  regex
CMakeLists.txt      dbug             scripts
COPYING             debian           sql
COPYING.LESSER      extra            sql-bench
Docs                include          sql-common
INSTALL-SOURCE      libmysql         storage
INSTALL-WIN-SOURCE  libmysqld        strings
KNOWN_BUGS.txt      libservices      support-files
README              man              tests
VERSION             mysql-test       unittest
client              mysys            vio
cmake               packaging        win
cmd-line-utils      plugin           zlib


mariadb需要cmake安装,同时将需要的软件包一起安装了。

[root@localhost soft]# yum install cmake    bison  gcc*  ncurses* -y


[root@localhost mariadb-5.5.33a]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/maria -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=0 -DBUILD_CONFIG=mysql_release -DFEATURE_SET=community -DWITH_EMBEDDED_SERVER=OFF -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DMYSQL_DATADIR=/mariadb


[root@localhost mariadb-5.5.33a]#  make







[root@localhost log]# chown mariadb.mariadb /mariadb -R

[root@localhost log]# chown mariadb.mariadb /var/log/maria  -R
[root@localhost log]# /usr/local/maria/scripts/mysql_install_db --user=mariadb  --basedir=/usr/local/maria --datadir=/mariadb
Installing MariaDB/MySQL system tables in '/mariadb' ...
OK
Filling help tables...
OK
初始化数据库成功

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

[root@localhost log]# yum install mysql  安装客户端


[root@localhost etc]# cd /usr/local/maria/etc/
[root@localhost etc]# cat my.cnf 
[mysqld]
basedir=/usr/local/maria
datadir=/mariadb
socket=/mariadb/maria.sock
user=mariadb
port=3306
log_error=/var/log/maria/mariadb-error.log
pid-file=/mariadb/maria.pid


# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0


[client]
port=3306
socket=/mariadb/maria.sock


[root@localhost etc]# mysql -S /mariadb/maria.sock 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.33a-MariaDB MariaDB Server


Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)


mysql> 




  相关解决方案