簡體   English   中英

通過Homebrew在Mac OS X Sierra上的MariaDB

[英]MariaDB on Mac OS X Sierra via Homebrew

更新到Sierra之后,MariaDB將不再在我的系統上啟動。 由於它不包含關鍵數據,因此我將其刪除並嘗試通過自制軟件重新安裝,但是安裝后失敗,並且我也無法手動運行mysql_install_db 一切都是最新的,我已經嘗試了多次。

我能夠啟動該服務,甚至可以創建一個新的數據庫和用戶,但是當嘗試設置用戶密碼時,數據庫將崩潰,並提示mysql.user已損壞。 運行optimize / analyze / repair似乎沒有任何作用。 同樣也不確定采取什么措施使MariaDB一次啟動...

常見錯誤似乎是mysqld got signal 4 ,這使我認為MariaDB與gcc之間存在不兼容?

任何幫助,不勝感激。

安裝MariaDB

無法運行安裝后步驟。

> brew install mariadb
==> Downloading https://homebrew.bintray.com/bottles/mariadb-10.1.18.sierra.bottle.tar.gz
Already downloaded: /Users/username/Library/Caches/Homebrew/mariadb-10.1.18.sierra.bottle.tar.gz
==> Pouring mariadb-10.1.18.sierra.bottle.tar.gz
==> Using the sandbox
==> /usr/local/Cellar/mariadb/10.1.18/bin/mysql_install_db --verbose --user=username --basedir=/usr/local/Cellar/mariadb/10.1.18 --datadir=/usr/local/var/mysql --tmpdir=/
Last 15 lines from /Users/username/Library/Logs/Homebrew/mariadb/post_install.01.mysql_install_db:

    shell> /usr/local/Cellar/mariadb/10.1.18/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
MariaDB is hosted on launchpad; You can find the latest source and
email lists at http://launchpad.net/maria

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`
==> Caveats
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.

To connect:
    mysql -uroot

To have launchd start mariadb now and restart at login:
  brew services start mariadb
Or, if you don't want/need a background service you can just run:
  mysql.server start
==> Summary
🍺  /usr/local/Cellar/mariadb/10.1.18: 574 files, 136.6M

通過Homebrew運行后期安裝

> brew postinstall mariadb
==> Using the sandbox
==> /usr/local/Cellar/mariadb/10.1.18/bin/mysql_install_db --verbose --user=username --basedir=/usr/local/Cellar/mariadb/10.1.18 --datadir=/usr/local/var/mysql --tmpdir=/
Last 15 lines from /Users/username/Library/Logs/Homebrew/mariadb/post_install.01.mysql_install_db:

    shell> /usr/local/Cellar/mariadb/10.1.18/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
MariaDB is hosted on launchpad; You can find the latest source and
email lists at http://launchpad.net/maria

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


READ THIS: https://git.io/brew-troubleshooting

手動運行mysql_install_db

> mysql_install_db --general-log
Installing MariaDB/MySQL system tables in '/usr/local/var/mysql' ...
2016-11-07 10:56:36 140735707972544 [Warning] 'THREAD_CONCURRENCY' is deprecated and will be removed in a future release.
2016-11-07 10:56:36 140735707972544 [Note] /usr/local/Cellar/mariadb/10.1.18/bin/mysqld (mysqld 10.1.18-MariaDB) starting as process 32902 ...
2016-11-07 10:56:36 7fff95e183c0 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
2016-11-07 10:56:36 140735707972544 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2016-11-07 10:56:36 140735707972544 [Note] InnoDB: The InnoDB memory heap is disabled
2016-11-07 10:56:36 140735707972544 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-11-07 10:56:36 140735707972544 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2016-11-07 10:56:36 140735707972544 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-11-07 10:56:36 140735707972544 [Note] InnoDB: Using SSE crc32 instructions
2016-11-07 10:56:36 140735707972544 [Note] InnoDB: Initializing buffer pool, size = 2.0G
2016-11-07 10:56:37 140735707972544 [Note] InnoDB: Completed initialization of buffer pool
161107 10:56:37 [ERROR] mysqld got signal 4 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.

To report this bug, see https://mariadb.com/kb/en/reporting-bugs

We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed, 
something is definitely wrong and this may fail.

Server version: 10.1.18-MariaDB
key_buffer_size=33554432
read_buffer_size=2097152
max_used_connections=0
max_threads=102
thread_count=0
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1079322 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x0 thread_stack 0x3c000
0   mysqld                              0x00000001076e62dc my_print_stacktrace + 60
0   mysqld                              0x00000001071c6b4e handle_fatal_signal + 632
0   libsystem_platform.dylib            0x00007fff8d307bba _sigtramp + 26
0   libcrypto.1.0.0.dylib               0x000000010886cebb OPENSSL_ia32cap_P + 8019
0   libcrypto.1.0.0.dylib               0x000000010878456d ssleay_rand_bytes + 248
0   mysqld                              0x00000001076f5200 my_random_bytes + 32
0   mysqld                              0x00000001075b2790 _Z27fil_space_create_crypt_data16fil_encryption_tj + 184
0   mysqld                              0x000000010769cda6 _Z34innobase_start_or_create_for_mysqlv + 4566
0   mysqld                              0x00000001075f28aa _ZL13innobase_initPv + 3046
0   mysqld                              0x00000001071c76de _Z24ha_initialize_handlertonP13st_plugin_int + 94
0   mysqld                              0x000000010732dd19 _ZL17plugin_initializeP11st_mem_rootP13st_plugin_intPiPPcb + 351
0   mysqld                              0x000000010732d9c9 _Z11plugin_initPiPPci + 2767
0   mysqld                              0x0000000107270c0a _ZL22init_server_componentsv + 1807
0   mysqld                              0x000000010726f017 _Z11mysqld_mainiPPc + 10571
0   libdyld.dylib                       0x00007fff8d0fa255 start + 1
0   ???                                 0x000000000000000a 0x0 + 10
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

Installation of system tables failed!  Examine the logs in
/usr/local/var/mysql for more information.

The problem could be conflicting information in an external
my.cnf files. You can ignore these by doing:

    shell> /usr/local/Cellar/mariadb/10.1.18/scripts/scripts/mysql_install_db --defaults-file=~/.my.cnf

You can also try to start the mysqld daemon with:

    shell> /usr/local/Cellar/mariadb/10.1.18/bin/mysqld --skip-grant --general-log &

and use the command line tool /usr/local/Cellar/mariadb/10.1.18/bin/mysql
to connect to the mysql database and look at the grant tables:

    shell> /usr/local/Cellar/mariadb/10.1.18/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
MariaDB is hosted on launchpad; You can find the latest source and
email lists at http://launchpad.net/maria

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

啟動數據庫

> mysql.server start
Starting MySQL
.161107 10:58:10 mysqld_safe Logging to '/usr/local/var/mysql/MacBook-Pro.local.err'.
 ERROR!

> cat MacBook-Pro.local.err 
161107 10:59:15 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2016-11-07 10:59:15 140735707972544 [Warning] 'THREAD_CONCURRENCY' is deprecated and will be removed in a future release.
2016-11-07 10:59:15 140735707972544 [Note] /usr/local/Cellar/mariadb/10.1.18/bin/mysqld (mysqld 10.1.18-MariaDB) starting as process 33473 ...
2016-11-07 10:59:15 140735707972544 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2016-11-07 10:59:15 140735707972544 [Note] Using unique option prefix 'myisam_recover' is error-prone and can break in the future. Please use the full name 'myisam-recover-options' instead.
2016-11-07 10:59:15 7fff95e183c0 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
2016-11-07 10:59:15 140735707972544 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2016-11-07 10:59:15 140735707972544 [Note] InnoDB: The InnoDB memory heap is disabled
2016-11-07 10:59:15 140735707972544 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-11-07 10:59:15 140735707972544 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2016-11-07 10:59:15 140735707972544 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-11-07 10:59:15 140735707972544 [Note] InnoDB: Using SSE crc32 instructions
2016-11-07 10:59:15 140735707972544 [Note] InnoDB: Initializing buffer pool, size = 2.0G
2016-11-07 10:59:15 140735707972544 [Note] InnoDB: Completed initialization of buffer pool
2016-11-07 10:59:15 140735707972544 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2016-11-07 10:59:15 140735707972544 [Note] InnoDB: Setting file ./ibdata1 size to 10 MB
2016-11-07 10:59:15 140735707972544 [Note] InnoDB: Database physically writes the file full: wait...
161107 10:59:15 [ERROR] mysqld got signal 4 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.

To report this bug, see https://mariadb.com/kb/en/reporting-bugs

We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed, 
something is definitely wrong and this may fail.

Server version: 10.1.18-MariaDB
key_buffer_size=33554432
read_buffer_size=2097152
max_used_connections=0
max_threads=102
thread_count=0
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1079322 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x0 thread_stack 0x3c000
0   mysqld                              0x000000010b9952dc my_print_stacktrace + 60
0   mysqld                              0x000000010b475b4e handle_fatal_signal + 632
0   libsystem_platform.dylib            0x00007fff8d307bba _sigtramp + 26
0   ???                                 0x000000010eb4ae0b 0x0 + 4541689355
0   libcrypto.1.0.0.dylib               0x000000010ca2d56d ssleay_rand_bytes + 248
0   mysqld                              0x000000010b9a4200 my_random_bytes + 32
0   mysqld                              0x000000010b861790 _Z27fil_space_create_crypt_data16fil_encryption_tj + 184
0   mysqld                              0x000000010b94bda6 _Z34innobase_start_or_create_for_mysqlv + 4566
0   mysqld                              0x000000010b8a18aa _ZL13innobase_initPv + 3046
0   mysqld                              0x000000010b4766de _Z24ha_initialize_handlertonP13st_plugin_int + 94
0   mysqld                              0x000000010b5dcd19 _ZL17plugin_initializeP11st_mem_rootP13st_plugin_intPiPPcb + 351
0   mysqld                              0x000000010b5dc9c9 _Z11plugin_initPiPPci + 2767
0   mysqld                              0x000000010b51fc0a _ZL22init_server_componentsv + 1807
0   mysqld                              0x000000010b51e017 _Z11mysqld_mainiPPc + 10571
0   libdyld.dylib                       0x00007fff8d0fa255 start + 1
0   ???                                 0x0000000000000009 0x0 + 9
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
161107 10:59:16 mysqld_safe mysqld from pid file /usr/local/var/mysql/MacBook-Pro.local.pid ended

系統信息

OSX

10.12.1

家釀

> brew -v
Homebrew 1.0.9
Homebrew/homebrew-core (git revision 3a20; last commit 2016-11-06)

> brew update
Already up-to-date.

> brew doctor
Your system is ready to brew.

GCC

> gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

MariaDB卸載

brew remove mariadb
rm -rf /usr/local/var/mysql
brew cleanup

在解決問題幾天,然后在發布問題后立即解決問題的悠久傳統中,我能夠在OSX Sierra上使用Homebrew安裝MariaDB。

我打算刪除並重新安裝XCode和命令行工具,但由於某種原因決定確保將其指向正確的路徑並運行:

sudo xcode-select --switch /Applications/Xcode.app

同時,我將stacktrace的ssleay_rand_bytesmy_random_bytes部分歸零,並認為也許未安裝openssl ,但隨后使用自制軟件將其重新安裝。 然后我決定在殺死XCode之前再嘗試一次,它確實有效...

已安裝openssl

> brew install openssl
Warning: openssl-1.0.2j already installed

重新安裝openssl

> brew reinstall openssl
==> Reinstalling openssl with --universal
==> Using the sandbox
==> Downloading https://www.openssl.org/source/openssl-1.0.2j.tar.gz
######################################################################## 100.0%
==> make clean
==> perl ./Configure --prefix=/usr/local/Cellar/openssl/1.0.2j --openssldir=/usr/local/etc/openssl no-ssl2 zlib-dynamic shared enable-cms darwin64-x86_64-cc enable-ec_nistp_6
==> make depend
==> make
xcode-select==> make test
==> make clean
==> perl ./Configure --prefix=/usr/local/Cellar/openssl/1.0.2j --openssldir=/usr/local/etc/openssl no-ssl2 zlib-dynamic shared enable-cms darwin-i386-cc
==> make depend
==> make
==> make test
==> make install MANDIR=/usr/local/Cellar/openssl/1.0.2j/share/man MANSUFFIX=ssl
==> lipo -create build-x86_64/libcrypto.1.0.0.dylib build-i386/libcrypto.1.0.0.dylib -output /usr/local/Cellar/openssl/1.0.2j/lib/libcrypto.1.0.0.dylib
==> lipo -create build-x86_64/libcrypto.a build-i386/libcrypto.a -output /usr/local/Cellar/openssl/1.0.2j/lib/libcrypto.a
==> lipo -create build-x86_64/libssl.1.0.0.dylib build-i386/libssl.1.0.0.dylib -output /usr/local/Cellar/openssl/1.0.2j/lib/libssl.1.0.0.dylib
==> lipo -create build-x86_64/libssl.a build-i386/libssl.a -output /usr/local/Cellar/openssl/1.0.2j/lib/libssl.a
==> lipo -create build-x86_64/engines/lib4758cca.dylib build-i386/engines/lib4758cca.dylib -output /usr/local/Cellar/openssl/1.0.2j/lib/engines/lib4758cca.dylib
==> lipo -create build-x86_64/engines/libaep.dylib build-i386/engines/libaep.dylib -output /usr/local/Cellar/openssl/1.0.2j/lib/engines/libaep.dylib
==> lipo -create build-x86_64/engines/libatalla.dylib build-i386/engines/libatalla.dylib -output /usr/local/Cellar/openssl/1.0.2j/lib/engines/libatalla.dylib
==> lipo -create build-x86_64/engines/libcapi.dylib build-i386/engines/libcapi.dylib -output /usr/local/Cellar/openssl/1.0.2j/lib/engines/libcapi.dylib
==> lipo -create build-x86_64/engines/libchil.dylib build-i386/engines/libchil.dylib -output /usr/local/Cellar/openssl/1.0.2j/lib/engines/libchil.dylib
==> lipo -create build-x86_64/engines/libcswift.dylib build-i386/engines/libcswift.dylib -output /usr/local/Cellar/openssl/1.0.2j/lib/engines/libcswift.dylib
==> lipo -create build-x86_64/engines/libgmp.dylib build-i386/engines/libgmp.dylib -output /usr/local/Cellar/openssl/1.0.2j/lib/engines/libgmp.dylib
==> lipo -create build-x86_64/engines/libgost.dylib build-i386/engines/libgost.dylib -output /usr/local/Cellar/openssl/1.0.2j/lib/engines/libgost.dylib
==> lipo -create build-x86_64/engines/libnuron.dylib build-i386/engines/libnuron.dylib -output /usr/local/Cellar/openssl/1.0.2j/lib/engines/libnuron.dylib
==> lipo -create build-x86_64/engines/libpadlock.dylib build-i386/engines/libpadlock.dylib -output /usr/local/Cellar/openssl/1.0.2j/lib/engines/libpadlock.dylib
==> lipo -create build-x86_64/engines/libsureware.dylib build-i386/engines/libsureware.dylib -output /usr/local/Cellar/openssl/1.0.2j/lib/engines/libsureware.dylib
==> lipo -create build-x86_64/engines/libubsec.dylib build-i386/engines/libubsec.dylib -output /usr/local/Cellar/openssl/1.0.2j/lib/engines/libubsec.dylib
==> lipo -create build-x86_64/openssl build-i386/openssl -output /usr/local/Cellar/openssl/1.0.2j/bin/openssl
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, which means it was not symlinked into /usr/local.

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries

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 to your
build variables:

    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include
    PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig

==> Summary
🍺  /usr/local/Cellar/openssl/1.0.2j: 1,696 files, 17.3M, built in 11 minutes 1 second

安裝mariadb

> brew install mariadb
==> Downloading https://homebrew.bintray.com/bottles/mariadb-10.1.18.sierra.bottle.tar.gz
Already downloaded: /Users/username/Library/Caches/Homebrew/mariadb-10.1.18.sierra.bottle.tar.gz
==> Pouring mariadb-10.1.18.sierra.bottle.tar.gz
==> Using the sandbox
==> /usr/local/Cellar/mariadb/10.1.18/bin/mysql_install_db --verbose --user=username --basedir=/usr/local/Cellar/mariadb/10.1.18 --datadir=/usr/local/var/mysql --tmpdir=/
==> Caveats
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.

To connect:
    mysql -uroot

To have launchd start mariadb now and restart at login:
  brew services start mariadb
Or, if you don't want/need a background service you can just run:
  mysql.server start
==> Summary
🍺  /usr/local/Cellar/mariadb/10.1.18: 574 files, 136.6M

連接到mariadb

> mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.1.18-MariaDB Homebrew

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]> exit
Bye

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM