热门标签 | 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.


推荐阅读
  • 本文探讨了Web开发与游戏开发之间的主要区别,旨在帮助开发者更好地理解两种开发领域的特性和需求。文章基于作者的实际经验和网络资料整理而成。 ... [详细]
  • 优化Flask应用的并发处理:解决Mysql连接过多问题
    本文探讨了在Flask应用中通过优化后端架构来应对高并发请求,特别是针对Mysql 'too many connections' 错误的解决方案。我们将介绍如何利用Redis缓存、Gunicorn多进程和Celery异步任务队列来提升系统的性能和稳定性。 ... [详细]
  • 本文介绍了数据库体系的基础知识,涵盖关系型数据库(如MySQL)和非关系型数据库(如MongoDB)的基本操作及高级功能。通过三个阶段的学习路径——基础、优化和部署,帮助读者全面掌握数据库的使用和管理。 ... [详细]
  • 简化报表生成:EasyReport工具的全面解析
    本文详细介绍了EasyReport,一个易于使用的开源Web报表工具。该工具支持Hadoop、HBase及多种关系型数据库,能够将SQL查询结果转换为HTML表格,并提供Excel导出、图表显示和表头冻结等功能。 ... [详细]
  • 本文深入探讨了MySQL中常见的面试问题,包括事务隔离级别、存储引擎选择、索引结构及优化等关键知识点。通过详细解析,帮助读者在面对BAT等大厂面试时更加从容。 ... [详细]
  • 前言无论是对于刚入行工作还是已经工作几年的java开发者来说,面试求职始终是你需要直面的一件事情。首先梳理自己的知识体系,针对性准备,会有事半功倍的效果。我们往往会把重点放在技术上 ... [详细]
  • 本文将详细介绍如何在ThinkPHP6框架中实现多数据库的部署,包括读写分离的策略,以及如何通过负载均衡和MySQL同步技术优化数据库性能。 ... [详细]
  • 全能终端工具推荐:高效、免费、易用
    介绍一款备受好评的全能型终端工具——MobaXterm,它不仅功能强大,而且完全免费,适合各类用户使用。 ... [详细]
  • 本文探讨了随着并发需求的增长,MySQL数据库架构如何从简单的单一实例发展到复杂的分布式系统,以及每一步演进背后的原理和技术解决方案。 ... [详细]
  • Spring Boot 入门指南
    本文介绍了Spring Boot的基本概念及其在现代Java应用程序开发中的作用。Spring Boot旨在简化Spring应用的初始设置和开发过程,通过自动配置和约定优于配置的原则,帮助开发者快速构建基于Spring框架的应用。 ... [详细]
  • Logging all MySQL queries into the Slow Log
    MySQLoptionallylogsslowqueriesintotheSlowQueryLog–orjustSlowLog,asfriendscallit.However,Thereareseveralreasonstologallqueries.Thislistisnotexhaustive:Belowyoucanfindthevariablestochange,astheyshouldbewritteninth ... [详细]
  • 1.介绍有时候我们需要一些模拟数据来进行测试,今天简单记录下如何用存储过程生成一些随机数据。2.建表我们新建一张学生表和教师表如下:CREATETABLEstudent(idINT ... [详细]
  • 本文详细介绍了在 Windows 7 系统中配置 Nginx 1.10.3 和 PHP 7.1.1 NTS 的步骤,包括修改 PHP 配置文件、处理依赖项以及创建批处理脚本启动和停止服务。重点解释了如何解决常见的运行时错误。 ... [详细]
  • 版本控制工具——Git常用操作(下)
    本文由云+社区发表作者:工程师小熊摘要:上一集我们一起入门学习了git的基本概念和git常用的操作,包括提交和同步代码、使用分支、出现代码冲突的解决办法、紧急保存现场和恢复 ... [详细]
  • 本文详细介绍了MySQL数据库中的Bin Log和Redo Log,阐述了它们在日志记录机制、应用场景以及数据恢复方面的区别。通过对比分析,帮助读者更好地理解这两种日志文件的作用和特性。 ... [详细]
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社区 版权所有