热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

FreeBSD系统如何安装MariaDB数据库

“MariaDBisacommunity-developedbranchoftheMySQLdatabase,theimpetusbeingthecommunitymaintenanceofitsfreestatusunderGPL,asopposedtoanyuncertaintyofMySQLlicensestat

“MariaDB is a community-developed branch of

the MySQL database, the impetus being the community maintenance of
its free status under GPL, as opposed to any uncertainty of MySQL
license status under its current ownership by Oracle.

The intent also being to maintain high fidelity with MySQL,
ensuring a “drop-in” replacement capability with library binary
equivalency and exacting matching with MySQL APIs and commands. It
includes the XtraDB storage engine as a replacement for InnoDB.

Its lead developer is Monty Widenius, the founder of MySQL and
Monty Program AB.”

Being curious I decide to install mariadb on my Freebsd 8.1 stable . My first option for install is via ports but at time writing I don’t find the mariadb port icon sad How to install mariadb on FreeBSD

After search and dig google I came up with solution on how to install mariadb from source.

Here the steps :

Add user and group for mariadb

# pw groupadd mysql
# pw adduser mysql -g mysql -d /usr/local/mysql

Download and extract mariadb tarball

# wget -c
http://ftp-stud.hs-esslingen.de/pub/Mirrors/mariadb/mariadb-5.1.50/kvm-tarbake-jaunty-x86/mariadb-5.1.50.tar.gz
&

#tar xvzf mariadb-5.1.50.tar.gz

#cd mariadb-5.1.50

Configure, make and make install

# ./configure ?with-plugins=max-no-ndb


Configuration summary for MariaDB Server version 5.1.50-MariaDB

* Installation prefix:       /usr/local
* System type:               unknown-freebsd8.1
* Host CPU:                  i386
* C Compiler:                gcc (GCC) 4.2.1 20070719  [FreeBSD]
* C++ Compiler:              g++ (GCC) 4.2.1 20070719  [FreeBSD]
* Debug enabled:             no
* Community Features:        yes

Thank you for choosing MariaDB!

# make && make install

# rehash

For more info around configure option you may refer to :

# ./configure ?help | more

Initialize and setting mariadb

# ./mysql_install_db

Installing MariaDB/MySQL system tables…
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

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

/usr/local/bin/mysqladmin -u root password ‘new-password’
/usr/local/bin/mysqladmin -u root -h goten.rasyid.net password ‘new-password’

Alternatively you can run:
/usr/local/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 MySQL manual for more instructions.

# cd /usr/local

# chown -R mysql:mysql var

Start mariadb for first time

# /usr/local/bin/mysqld_safe &

[1] 58333
goten# 101110 10:34:31 mysqld_safe Logging to ‘/usr/local/var/goten.rasyid.net.err’.
101110 10:34:31 mysqld_safe Starting mysqld daemon with databases from /usr/local/var

Check the process

# ps -ax | grep mysql

58333   0  I      0:00.09 /bin/sh /usr/local/bin/mysqld_safe
58375   0  I      0:03.39 /usr/local/libexec/mysqld ?basedir=/usr/local ?datadir=/usr/local/var ?user=mysql ?log-error=/

Try to access mariadb

# mysql -uroot -p

Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 1
Server version: 5.1.50-MariaDB Source distribution

This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

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

MariaDB [(none)]> show databases;
+——————?+
| Database           |
+——————?+
| information_schema |
| mysql              |
| test               |
+——————?+
3 rows in set (0.10 sec)

MariaDB [(none)]>

MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [mysql]>

List the engines inside mariadb

MariaDB [(none)]> SHOW ENGINES\G
*************************** 1. row ***************************
Engine: BLACKHOLE
Support: YES
Comment: /dev/null storage engine (anything you write to it disappears)
Transactions: NO
XA: NO
Savepoints: NO
*************************** 2. row ***************************
Engine: MRG_MYISAM
Support: YES
Comment: Collection of identical MyISAM tables
Transactions: NO
XA: NO
Savepoints: NO
*************************** 3. row ***************************
Engine: FEDERATED
Support: YES
Comment: FederatedX pluggable storage engine
Transactions: YES
XA: NO
Savepoints: YES
*************************** 4. row ***************************

Engine: MARIA
Support: YES
Comment: Crash-safe tables with MyISAM heritage
Transactions: YES
XA: NO
Savepoints: NO
*************************** 5. row ***************************
Engine: CSV
Support: YES
Comment: CSV storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 6. row ***************************
Engine: MEMORY
Support: YES
Comment: Hash based, stored in memory, useful for temporary tables
Transactions: NO
XA: NO
Savepoints: NO

*************************** 7. row ***************************
Engine: ARCHIVE
Support: YES
Comment: Archive storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 8. row ***************************
Engine: MyISAM
Support: DEFAULT
Comment: Default engine as of MySQL 3.23 with great performance
Transactions: NO
XA: NO
Savepoints: NO
*************************** 9. row ***************************
Engine: InnoDB
Support: YES
Comment: Percona-XtraDB, Supports transactions, row-level locking, and foreign keys
Transactions: YES
XA: YES
Savepoints: YES
*************************** 10. row ***************************
Engine: PBXT
Support: YES
Comment: High performance, multi-versioning transactional engine
Transactions: YES
XA: YES
Savepoints: NO
10 rows in set (0.00 sec)

MariaDB [(none)]>

Make mariadb service start at boot time

create new file called mariadb and put in /usr/local/etc/rc.d

# ee /usr/local/etc/rc.d/mariadb

Enter this :

#!/bin/sh

# PROVIDE: mariadb

. /etc/rc.subr

name=”mariadb”
rcvar=`set_rcvar`
start_cmd=”mariadb_start”
stop_cmd=”:”

load_rc_config $name

mariadb_start()
{
if checkyesno ${rcvar}; then
/usr/local/bin/mysqld_safe &
fi
}

run_rc_command “$1″

make the script executable

# chmod +x /usr/local/etc/rc.d/mariadb

Enable the service by adding it to rc.conf

# echo ‘mariadb_enable=”YES”‘ >> /etc/rc.conf

Try restart server to test the script and check it with ps command.

# ps -ax | grep sql

893  ??  Is     0:00.35 /usr/local/bin/postmaster -D /usr/local/pgsql/data (postgres)
903  v0- I      0:00.06 /bin/sh /usr/local/bin/mysqld_safe
955  v0- I      0:04.09 /usr/local/libexec/mysqld ?basedir=/usr/local ?datadir=/usr/local/var ?user=mysql ?log-error=/
#

Done.

mariadb successfully installed on my FreeBSD 8.1 box.


推荐阅读
  • 优化Flask应用的并发处理:解决Mysql连接过多问题
    本文探讨了在Flask应用中通过优化后端架构来应对高并发请求,特别是针对Mysql 'too many connections' 错误的解决方案。我们将介绍如何利用Redis缓存、Gunicorn多进程和Celery异步任务队列来提升系统的性能和稳定性。 ... [详细]
  • 本文介绍了数据库体系的基础知识,涵盖关系型数据库(如MySQL)和非关系型数据库(如MongoDB)的基本操作及高级功能。通过三个阶段的学习路径——基础、优化和部署,帮助读者全面掌握数据库的使用和管理。 ... [详细]
  • 本文详细介绍了如何解决在使用本地SQlyog客户端尝试连接阿里云上的MariaDB数据库时遇到的2003错误,即无法连接到MySQL服务器的问题。 ... [详细]
  • golang常用库:配置文件解析库/管理工具viper使用
    golang常用库:配置文件解析库管理工具-viper使用-一、viper简介viper配置管理解析库,是由大神SteveFrancia开发,他在google领导着golang的 ... [详细]
  • 本文详细探讨了不同SQL数据库管理系统(DBMS)在限制输出结果、拼接字段和日期时间处理方面的函数差异。通过具体示例,帮助读者理解并掌握如何在不同DBMS中实现相同功能。 ... [详细]
  • PHP 5.2.5 安装与配置指南
    本文详细介绍了 PHP 5.2.5 的安装和配置步骤,帮助开发者解决常见的环境配置问题,特别是上传图片时遇到的错误。通过本教程,您可以顺利搭建并优化 PHP 运行环境。 ... [详细]
  • 本文详细介绍了 Dockerfile 的编写方法及其在网络配置中的应用,涵盖基础指令、镜像构建与发布流程,并深入探讨了 Docker 的默认网络、容器互联及自定义网络的实现。 ... [详细]
  • 本文详细介绍了Python编程语言的学习路径,涵盖基础语法、常用组件、开发工具、数据库管理、Web服务开发、大数据分析、人工智能、爬虫开发及办公自动化等多个方向。通过系统化的学习计划,帮助初学者快速掌握Python的核心技能。 ... [详细]
  • 简化报表生成:EasyReport工具的全面解析
    本文详细介绍了EasyReport,一个易于使用的开源Web报表工具。该工具支持Hadoop、HBase及多种关系型数据库,能够将SQL查询结果转换为HTML表格,并提供Excel导出、图表显示和表头冻结等功能。 ... [详细]
  • 本文介绍了一个基于 Java SpringMVC 和 SSM 框架的综合系统,涵盖了操作日志记录、文件管理、头像编辑、权限控制、以及多种技术集成如 Shiro、Redis 等,旨在提供一个高效且功能丰富的开发平台。 ... [详细]
  • 本文深入探讨了MySQL中常见的面试问题,包括事务隔离级别、存储引擎选择、索引结构及优化等关键知识点。通过详细解析,帮助读者在面对BAT等大厂面试时更加从容。 ... [详细]
  • 前言无论是对于刚入行工作还是已经工作几年的java开发者来说,面试求职始终是你需要直面的一件事情。首先梳理自己的知识体系,针对性准备,会有事半功倍的效果。我们往往会把重点放在技术上 ... [详细]
  • Linux虚拟机中MySQL安装指南
    本文详细介绍了如何在Linux虚拟机上安装MySQL,包括解决常见问题的方法和步骤。 ... [详细]
  • 本文档详细介绍了2017年8月31日关于MySQL数据库备份与恢复的教学内容,包括MySQL日志功能、备份策略、备份工具及实战演练。 ... [详细]
  • 深入探讨CPU虚拟化与KVM内存管理
    本文详细介绍了现代服务器架构中的CPU虚拟化技术,包括SMP、NUMA和MPP三种多处理器结构,并深入探讨了KVM的内存虚拟化机制。通过对比不同架构的特点和应用场景,帮助读者理解如何选择最适合的架构以优化性能。 ... [详细]
author-avatar
mobiledu2502881767
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有