赞
踩
brew install mysql后并没有进行my.cnf配置,所有新建了个my.cnf文件将以前的配置项都添加到了这个配置文件中,然后重启MySQL服务,结果就报错了
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/bogon.pid).
网上找了资料,并没有解决我的问题,后面只能是逐一排查
这是我的配置文件(/etc/my.cnf)简单的内容
- # For advice on how to change settings please see
- # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
- # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
- # *** default location during install, and will be replaced if you
- # *** upgrade to a newer version of MySQL.
- [client]
- default-character-set=utf8mb4
-
- [mysql]
- default-character-set=utf8mb4
-
- [mysqld]
- character-set-client-handshake = FALSE
- character-set-server = utf8mb4
- collation-server = utf8mb4_unicode_ci
- init_connect='SET NAMES utf8mb4'
- lower_case_table_names=1
-
- # Remove leading # and set to the amount of RAM for the most important data
- # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
- # innodb_buffer_pool_size = 128M
-
- # Remove leading # to turn on a very important data integrity option: logging
- # changes to the binary log between backups.
- # log_bin
-
- # These are commonly set, remove the # and set as required.
- # basedir = .....
- # datadir = .....
- # port = .....
- # server_id = .....
- # socket = .....
-
- # Remove leading # to set options mainly useful for reporting servers.
- # The server defaults are faster for transactions and fast SELECTs.
- # Adjust sizes as needed, experiment to find the optimal values.
- # join_buffer_size = 128M
- # sort_buffer_size = 2M
- # read_rnd_buffer_size = 2M
-
- sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER"

启动MySQL服务
- $ mysql.server start
- Starting MySQL
- .. ERROR! The server quit without updating PID file (/usr/local/var/mysql/bogon.pid).
就发现包这个错误,尝试了各种办法授权目录,等等没结果,后面只能是逐一排查my.cnf文件里面的配置,结果真的是这个配置文件里面的问题,我一行一行的注释后再启动,终于在注释以下两个配置项后,终于不报这个错误了。
- # lower_case_table_names=1
-
- # sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER"
-
- 或者将sql_mode中的NO_AUTO_CREATE_USER去掉也可以
然后启动错误不报但又有以下的提示信息
- $ mysql.server start
- Starting MySQL
- SUCCESS!
- bogon:~ liwu$ 2019-06-19T08:17:38.6NZ mysqld_safe A mysqld process already exists
出现这种提示的时候可以使用Brew service来操作MySQL服务,先停止MySQL服务
- $ brew services stop mysql
- Stopping `mysql`... (might take a while)
- ==> Successfully stopped `mysql` (label: homebrew.mxcl.mysql)
- bogon:~ liwu$ mysql.server start
- Starting MySQL
- . SUCCESS!
至此此问题终于得到了一个解答
总结:
我觉得出现这种现象有几种种可能
1、我的MySQL不是在官网下载对应兼容版本的*.dmg安装包
2、我是采用的HomeBrew方式安装的,没有原始安装包那么齐全
3、有可能是MySQL版本的问题,我现在的版本是MySQL-8.0.16,但这个怀疑还得得到验证
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。