执行命令
sudo /usr/local/mysql/support-files/mysql.server start
报错如下
my_print_defaults: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1.
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
Starting MySQL
.my_print_defaults: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1.
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
my_print_defaults: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1.
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
Logging to '/usr/local/mysql/data/macdeMacBook-Pro.local.err'.
ERROR! The server quit without updating PID file (/usr/local/mysql/data/macdeMacBook-Pro.local.pid).
参考:https://blog.csdn.net/object_oriented_/article/details/105219941
1、
在/opt/mysql/mysql-5.7.25/support-files目录下创建my_default.cnf touch my_default.cnf
复制如下内容至my_default.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.
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
basedir = /opt/mysql/mysql-5.7.29
datadir = /opt/mysql/mysql-5.7.29/data
port = 3306
socket = /tmp/mysql.sock
character-set-server=utf8
log-error = /opt/mysql/mysql-5.7.29/data/mysqld.log
pid-file = /opt/mysql/mysql-5.7.29/data/mysqld.pid
这些路径可见mysql configuration
2、拷贝文件至/etc
sudo cp support-files/my_default.cnf /etc/my.cnf
如果提示是否覆盖,y