Homebrew MariaDB Server Start Error with 'mysql.server start'
문제
When starting MariaDB 10.3.8 on MacOS 10.13.6 the following strange behavior occurs:
mac:~user$ mysql.server start
Starting MariaDB
.180813 17:50:11 mysqld_safe Logging to
'/usr/local/var/mysql/mbp.local.err'.
180813 17:50:11 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql.. ERROR!
There are actually many more dots in the output before ERROR! is displayed; the process takes a couple of minutes. The odd thing is the server does run. And shutdown appears normal:
mac:~user$ mysql.server stop
Shutting down MariaDB.. SUCCESS!
Any idea how to determine what is causing the error message on startup and fix it?
해결책
I can reproduce your issue. Don't use mysql.server start
in macOS.
If you installed MariaDB with homebrew
, use brew services
to start and stop the database. It takes only a second and doesn't write strange error to stdout.
brew services stop mariadb
Stopping `mariadb`... (might take a while)
==> Successfully stopped `mariadb` (label: homebrew.mxcl.mariadb)
brew services start mariadb
==> Successfully started `mariadb` (label: homebrew.mxcl.mariadb)
overview of services in homebrew:
brew services list
Name Status User Plist
logstash stopped
mariadb started Kim /Users/Kim/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
mysql stopped
general help
brew services --help
brew services command:
Integrates Homebrew formulae with macOS' launchctl manager.
[sudo] brew services list
List all running services for the current user (or root)
[sudo] brew services run formula|--all
Run the service formula without starting at login (or boot).
[sudo] brew services start formula|--all
Start the service formula immediately and register it to launch at login (or boot).
[sudo] brew services stop formula|--all
Stop the service formula immediately and unregister it from launching at login (or boot).
[sudo] brew services restart formula|--all
Stop (if necessary) and start the service immediately and register it to launch at login (or boot).
[sudo] brew services cleanup
Remove all unused services.
If sudo is passed, operate on /Library/LaunchDaemons (started at boot).
Otherwise, operate on ~/Library/LaunchAgents (started at login).
다른 팁
I resolved the problem by changing .my.cnf from:
[client]
user=myname
password=mypwd
database=mydb
to:
[client]
user=myname
password=mypwd
[mysql]
database=mydb