在更新到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
答案 0 :(得分:3)
长期以来一直处理问题,然后在发布问题后立即解决问题......我能够在OSX Sierra上使用Homebrew安装MariaDB。
我准备删除并重新安装XCode和命令行工具,但出于某种原因决定确保它指向正确的路径并运行:
sudo xcode-select --switch /Applications/Xcode.app
与此同时,我在堆栈跟踪的ssleay_rand_bytes
和my_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