在Mac Mojave上安装mysql 5.7时遇到很多麻烦,(运行'brew install [email protected]')
在初次安装时,收到消息,提示安装后未成功完成(请参见下面的消息)。
因此,删除目录/ usr / local / var / mysql中的所有内容(mysql表示不为空)后,重新运行postinstall命令时,我仍然会收到相同的消息...(很烦人的是,MySQL是填充数据目录,然后抱怨它不为空?!)
[08:02:48][~/tmp]#brew postinstall [email protected]
==> Postinstalling [email protected]
==> /usr/local/Cellar/[email protected]/5.7.28/bin/mysqld --initialize-insecure --user=gert --basedir=/usr/local/Cellar/[email protected]/5.7.28 --datadir=/usr/local/var/my Last 15 lines from /Users/gert/Library/Logs/Homebrew/[email protected]/post_install.01.mysqld: 2019-12-09 08:03:39 +0200
/usr/local/Cellar/[email protected]/5.7.28/bin/mysqld
--initialize-insecure
--user=gert
--basedir=/usr/local/Cellar/[email protected]/5.7.28
--datadir=/usr/local/var/mysql
--tmpdir=/tmp
2019-12-09T06:03:39.151987Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use
--explicit_defaults_for_timestamp server option (see documentation for more details). 2019-12-09T06:03:39.154025Z 0
[ERROR] --initialize specified but the data directory has files in it. Aborting. 2019-12-09T06:03:39.154074Z 0 [ERROR] Aborting
尝试以root用户身份启动mysql会出现错误:
[[08:04:41] [〜/ tmp] #sudo /usr/local/opt/[email protected]/bin/mysql.server start密码:正在启动MySQL .....错误!服务器退出而不更新PID文件(/var/run/mysqld/mysqld.pid)。
现在想将墙壁靠在墙上几天,试图跟踪StackOverflow帖子MySql server startup error 'The server quit without updating PID file ',但都没有起作用...
我的my.cnf:
[mysqld]
# Only allow connections from localhost
#bind-address = 127.0.0.1
#SO posts said to comment out the above ...
pid-file = /var/run/mysqld/mysqld.pid #Checked, this folder + file exists, with write permissions
[尝试使用远离mysql目录的数据目录,即,如果mysql在/ usr / local / mysql中,则将数据目录用作/ var / data。
root@photon [ /var ]# /usr/local/mysql/bin/mysqld --initialize-insecure --user=mysql --datadir=/var/data
2020-02-22T21:42:27.121230Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.19) initializing of server in progress as process 820
2020-02-22T21:42:35.018238Z 5 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.