Compilare MariaDB su Mac OS X usando Homebrew

MariaDB è disponibile attraverso il gestore di pacchetti Homebrew, che è stato descritto come package manager che manca a Mac OS X. Una volta installato Homebrew (eseguendo da riga di comando brew), tutto ciò che occorre fare è questo:

brew update

Compilare MariaDB

A questo punto è possibile eseguire ricerche (brew search mariadb) e, se si desiderano maggiori informazioni, si può eseguire: brew info mariadb. Quando si è pronti a installare MariaDB, si esegua semplicemente:

brew install mariadb

Con MariaDB 5.2.6, produce un output su riga di comando simile al seguente:

lovegood:~ byte$ brew install mariadb
Warning: It appears you have Macports or Fink installed
Software installed with other package managers causes known problems for
Homebrew. If formula fail to build uninstall Macports/Fink and reinstall any
affected formula.
Also installing dependencies: readline
==> Downloading ftp://ftp.cwru.edu/pub/bash/readline-6.2.tar.gz
######################################################################## 100.0%
==> Downloading patches
######################################################################## 100.0%
==> Patching
patching file vi_mode.c
patching file callback.c
==> ./configure --prefix=/usr/local/Cellar/readline/6.2.1 --mandir=/usr/local/Ce
==> make install
==> Caveats
This formula is keg-only, so it was not symlinked into /usr/local.

OS X provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.


Generally there are no consequences of this for you.
If you build your own software and it requires this formula, you'll need
to add its lib & include paths to your build variables:

  LDFLAGS: -L/usr/local/Cellar/readline/6.2.1/lib
  CPPFLAGS: -I/usr/local/Cellar/readline/6.2.1/include
==> Summary
/usr/local/Cellar/readline/6.2.1: 32 files, 2.1M, built in 31 seconds
==> Downloading http://ftp.osuosl.org/pub/mariadb/mariadb-5.2.6/kvm-tarbake-jaun
######################################################################## 100.0%
==> ./configure --without-docs --without-debug --disable-dependency-tracking --p
==> make install
==> Caveats
Set up databases with:
    unset TMPDIR
    mysql_install_db

If this is your first install, automatically load on login with:
    cp /usr/local/Cellar/mariadb/5.2.6/com.mysql.mysqld.plist ~/Library/LaunchAgents
    launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist

If this is an upgrade and you already have the com.mysql.mysqld.plist loaded:
    launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
    cp /usr/local/Cellar/mariadb/5.2.6/com.mysql.mysqld.plist ~/Library/LaunchAgents
    launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist

Note on upgrading:
    We overwrite any existing com.mysql.mysqld.plist in ~/Library/LaunchAgents
    if we are upgrading because previous versions of this brew created the
    plist with a version specific program argument.

Or start manually with:
    mysql.server start
Warning: m4 macros were installed to "share/aclocal".
Homebrew does not append "/usr/local/share/aclocal"
to "/usr/share/aclocal/dirlist". If an autoconf script you use
requires these m4 macros, you'll need to add this path manually.
==> Summary
/usr/local/Cellar/mariadb/5.2.6: 231 files, 44M, built in 10.9 minutes
lovegood:~ byte$

Installare MariaDB

Completato questo passaggio, occorre eseguire:

unset TMPDIR
mysql_install_db

Quando si avvia mysql_install_db,si riceve l'output seguente:

lovegood:~ byte$ mysql_install_db 
Installing MariaDB/MySQL system tables in '/usr/local/var/mysql' ...
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/Cellar/mariadb/5.2.6/bin/mysqladmin -u root password 'new-password'
/usr/local/Cellar/mariadb/5.2.6/bin/mysqladmin -u root -h lovegood.local password 'new-password'

Alternatively you can run:
/usr/local/Cellar/mariadb/5.2.6/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 knowledge or the MySQL manual for more instructions.

You can start the MariaDB daemon with:
cd /usr/local/Cellar/mariadb/5.2.6 ; /usr/local/Cellar/mariadb/5.2.6/bin/mysqld_safe --datadir=/usr/local/var/mysql

You can test the MariaDB daemon with mysql-test-run.pl
cd /usr/local/Cellar/mariadb/5.2.6/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/local/Cellar/mariadb/5.2.6/bin/mysqlbug script!

The latest information about MariaDB is available at http://www.askmonty.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Support MariaDB development by buying support/new features from
Monty Program Ab. You can contact us about this at [email protected].
Alternatively consider joining our community based development effort:
http://askmonty.org/wiki/index.php/MariaDB#How_can_I_participate_in_the_development_of_MariaDB

lovegood:~ byte$ 

Avviare MariaDB

Completato questo passaggio, se si è in un ambiente di produzione, si ricordi di avviare mysql_secure_installation.Se si sta eseguendo un test, si seguano queste istruzioni:

lovegood:~ byte$ cd /usr/local/Cellar/mariadb/5.2.6 ; /usr/local/Cellar/mariadb/5.2.6/bin/mysqld_safe --datadir=/usr/local/var/mysql
110614 20:27:38 mysqld_safe Logging to '/usr/local/var/mysql/lovegood.local.err'.
chown: /usr/local/var/mysql/lovegood.local.err: Operation not permitted
110614 20:27:38 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql

Ecco fatto! E' ora possibile eseguire mysql -uroot ed effettuare il login.

Usare MariaDB

lovegood:~ byte$ mysql -uroot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 5.2.6-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)]> SELECT VERSION();
+---------------+
| VERSION()     |
+---------------+
| 5.2.6-MariaDB |
+---------------+
1 row in set (0.00 sec)

MariaDB [(none)]> 

Aggiornare MariaDB

Prima occorre aggiornare la propria installazione di brew. Si può farlo con il comando brew update.Poi si esegua semplicemente:

brew upgrade mariadb

E' possibile che appaiano alcuni messaggi di errore su OS X 10.7:

Warning: Your Xcode (4.3.3) is outdated
Please install Xcode 4.5.2.

E' possibile ignorare questi errori in modo sicuro e aggiornare a 5.5.28 senza problemi.

Problemi noti

Attualmente (serie 5.3), nella compilazione di default mancano alcuni Storage Engine. Si può verificarlo così:

MariaDB [(none)]> SHOW ENGINES;
+------------+---------+--------------------------------------------------------------------------------------------------+--------------+------+------------+
| Engine     | Support | Comment                                                                                          | Transactions | XA   | Savepoints |
+------------+---------+--------------------------------------------------------------------------------------------------+--------------+------+------------+
| MyISAM     | DEFAULT | Default engine as of MySQL 3.23 with great performance                                           | NO           | NO   | NO         |
| InnoDB     | YES     | XtraDB engine based on InnoDB plugin. Supports transactions, row-level locking, and foreign keys | YES          | YES  | YES        |
| CSV        | YES     | CSV storage engine                                                                               | NO           | NO   | NO         |
| MEMORY     | YES     | Hash based, stored in memory, useful for temporary tables                                        | NO           | NO   | NO         |
| MRG_MYISAM | YES     | Collection of identical MyISAM tables                                                            | NO           | NO   | NO         |
+------------+---------+--------------------------------------------------------------------------------------------------+--------------+------+------------+
5 rows in set (0.00 sec)

MariaDB [(none)]> 

Perché non ci sono binari per Mac nella pagina dei download

MariaDB è un progetto open source e per poter fornire i binari per una specifica piattaforma ha bisogno di qualcuno che:

  • Fornisca un buildbot slave con Mac OSX dove poter creare le build.
  • Aiuti a creare i pacchetti appropriati per Mac OSX.
  • Ci sponsorizzi con una macchina Mac OSX per le build.

Altre risorse

Commenti

Sto caricando i commenti......
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.