数据库

 首页 > 数据库 > mariadb > FreeBSD系统如何安装MariaDB 数据库

FreeBSD系统如何安装MariaDB 数据库

分享到:
【字体:
导读:
         摘要:“MariaDBisacommunity-developedbranchoftheMySQLdatabase,theimpetusbeingthecommunitymaintenanceofitsfreestatusunderGPL,asopposedtoanyuncertaintyofMySQLlicensestat...

FreeBSD系统如何安装MariaDB 数据库

“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 ENGINESG
*************************** 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.

FreeBSD系统如何安装MariaDB 数据库
分享到:
MariaDB数据库将替代仓库中的MySQL
MariaDB数据库将替代仓库中的MySQL MariaDB 现在是我们官方默认的 MySQL 实现。MariaDB 基本上和 MySQL 差不多,所以升级应该非常容易。但是由于剩下的兼容性考量,自动替换升级尚未完成。 我们推荐所有用户升级。MySQL 将在一个月内从仓库移动到 AUR。 希望切换的用户需要安装 mariadb, libmariadbclient 或者 ...
将两个MySQL数据表的查询结果插入新表的...
将两个MySQL数据表的查询结果插入新表的方法 下面为您介绍的方法实现的是两张表的MYSQL查询结果插入一张新表,该方法供您参考,如果您在MYSQL查询结果处理方面遇到过问题,不妨一看。 表A +-------------------+ |id  |user  |info   | |1   |u1    |991    | |3   |u3    |113    | +------------...
  •         php迷,一个php技术的分享社区,专属您自己的技术摘抄本、收藏夹。
  • 在这里……