4

Edit 2020-10-12:

I'm on macOS 10.15.7, the versions in brew formulas is 10.5.6 for mariadb and 8.0.21 for mysql. (you can check them in /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/{mariadb,mysql}.rb).

Mysql works fine after a clean install by brew uninstall mysql and removing anything related in $(brew --prefix), but mariadb still won't work with brew unlink mysql && brew link mariadb && brew services start mariadb without removing mysql database files in $(brew --prefix).

Original question:

So I'm running macOS 10.15.2 Catalina and try to install mariadb (10.4.11, the lastest version) with Homebrew.

After running brew install mariadb, brew warned that the postinstalllation didn't complete successfully:

==> Postinstalling mariadb
==> /usr/local/Cellar/mariadb/10.4.11/bin/mysql_install_db --verbose --user=me --basedir=/usr/local/Cellar/mariadb/10.4.11 --datadir=
Last 15 lines from /Users/me/Library/Logs/Homebrew/mariadb/post_install.01.mysql_install_db:

    shell> /usr/local/Cellar/mariadb/10.4.11/bin/mysql -u root mysql
    mysql> show tables;

Try 'mysqld --help' if you have problems with paths.  Using
--general-log gives you a log in /usr/local/var/mysql that may be helpful.

The latest information about mysql_install_db is available at
https://mariadb.com/kb/en/installing-system-tables-mysql_install_db
You can find the latest source at https://downloads.mariadb.org and
the maria-discuss email list at https://launchpad.net/~maria-discuss

Please check all of the above before submitting a bug report
at http://mariadb.org/jira

Warning: The post-install step did not complete successfully
You can try again using `brew postinstall mariadb`

I'm new to mariadb / mysql and so I followed this guide from mariadb.com (as @klanomath pointed out, this is oudated (2016)) and ran mysql_install_db:

$ mysql_install_db
WARNING: The host 'mymac' could not be looked up with /usr/local/Cellar/mariadb/10.4.11/bin/resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MariaDB version. The MariaDB daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MariaDB privileges !
Installing MariaDB/MySQL system tables in '/usr/local/var/mysql' ...
2020-02-07 20:26:33 0 [ERROR] InnoDB: Invalid flags 0x4800 in ./ibdata1
2020-02-07 20:26:33 0 [ERROR] InnoDB: Plugin initialization aborted with error Data structure corruption
2020-02-07 20:26:33 0 [ERROR] Plugin 'InnoDB' init function returned error.
2020-02-07 20:26:33 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2020-02-07 20:26:33 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2020-02-07 20:26:33 0 [ERROR] Aborting

And the log from mysqld:

$ mysqld --general-log
2020-02-07 20:44:45 0 [Note] mysqld (mysqld 10.4.11-MariaDB-log) starting as process 78097 ...
2020-02-07 20:44:45 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2020-02-07 20:44:45 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-02-07 20:44:45 0 [Note] InnoDB: Uses event mutexes
2020-02-07 20:44:45 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-02-07 20:44:45 0 [Note] InnoDB: Number of pools: 1
2020-02-07 20:44:45 0 [Note] InnoDB: Using SSE2 crc32 instructions
2020-02-07 20:44:45 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-02-07 20:44:45 0 [Note] InnoDB: Completed initialization of buffer pool
2020-02-07 20:44:45 0 [ERROR] InnoDB: Invalid flags 0x4800 in ./ibdata1
2020-02-07 20:44:45 0 [ERROR] InnoDB: Plugin initialization aborted with error Data structure corruption
2020-02-07 20:44:46 0 [Note] InnoDB: Starting shutdown...
2020-02-07 20:44:46 0 [ERROR] Plugin 'InnoDB' init function returned error.
2020-02-07 20:44:46 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2020-02-07 20:44:46 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-02-07 20:44:46 0 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
2020-02-07 20:44:46 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2020-02-07 20:44:46 0 [ERROR] Aborting

I did some research but couldn't find anything helpful. How do I complete mariadb installation? Any help is appreciated!

6
  • 1
    The linked instructions are probably outdated (2016-08-16!). Please add the output of brew list! BTW: I had no problem to install mariadb 10.4.11 in my Lab environment. – klanomath Feb 7 '20 at 13:12
  • @klanomath Oh I didn't notice that! The out put of brew list is just hundreds of lines of formulas I've installed, including mariadb latest version, not including earlier version. – Teddy C Feb 7 '20 at 14:15
  • @klanomath output of brew list, no percona* or mysql :) – Teddy C Feb 7 '20 at 14:39
  • @klanomath thank you for doing this! Actually I've uninstalled / unlinked mariadb@10.3. So no, it's not running at the moment. Now I unlinked mariadb and installed mysql instead and it worked great so far. I really appreciate your help! – Teddy C Feb 7 '20 at 16:04
  • 2
    In my opinion mariadb10.4-postinstall expected either no datadir or an empty datadir - and failed because of the non-empty mariadb10.3 datadir - I haven't been able to reproduce the error you encountered, though installing mariadb10.3/10.4 several times with slightly different methods. – klanomath Feb 7 '20 at 16:10
2

I have a solution that worked for me. I was trying to install the latest version of mariadb (10.5.6) First stop any mysql service that you might have running

brew services stop mariadb

Next you need to delete the contents of /usr/local/var/mysql sudo rm -rf /usr/local/var/mysql

You then need to create the database installation files

mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mariadb)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

This will get the mariadb Cellar location as installed by brew and do the db file installation. Next step is to start up mariadb brew services start mariadb

We now need to set up a password. Don't bother with mysql_secure_connection or mariadb-secure-connection. I had issues with them

Log into mysql sudo mariadb -u root

We now need to change the user root's password

> use mysql;

> ALTER USER 'root'@'localhost' IDENTIFIED BY 'mypassword';

> flush privileges;

> quit

You can now try logging into mariadb mariadb -u root -p

2
  • Thank you for the solution! I'm new to mysql / mariadb, may I ask why I need to delete /usr/local/var/mysql ? Is it because of incompatible database format? Does mariadb use /usr/local/var/mysql dir too? – Teddy C Oct 12 '20 at 14:14
  • You need to delete since there is an error with mariadb postinstall actions. Mariadb does have a /usr/local/var/mysql dir too – PhillipMwaniki Oct 12 '20 at 17:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .