我想在mac上设置[email protected]。我的本地有多个版本的mysql,我把它们都删除了,按照这个帖子的步骤安装了[email protected]。在通过Brew安装MySQL后,我得到了一个错误 - 服务器没有更新PID文件就退出了。:
brew remove mysql
brew cleanup
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /usr/local/var/mysql
brew install [email protected]
ln -s /usr/local/Cellar/mysql\@5.6/5.6.47/bin/mysql /usr/local/bin/mysql
我没有 my.cnf
文件夹 /etc
所以我用以下内容创建了这个。
[mysqld]
bind-address = 127.0.0.1
现在,当我做 mysql.server start遇到以下错误。
... ERROR! The server quit without updating PID file (/usr/local/var/mysql/my.pid).
我检查了日志文件,我看到以下错误。
2020-04-28 11:17:49 48498 [Note] Plugin 'FEDERATED' is disabled.
/usr/local/opt/[email protected]/bin/mysqld: Table 'mysql.plugin' doesn't exist
2020-04-28 11:17:49 48498 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2020-04-28 11:17:49 48498 [Note] InnoDB: Using atomics to ref count buffer pool pages
2020-04-28 11:17:49 48498 [Note] InnoDB: The InnoDB memory heap is disabled
2020-04-28 11:17:49 48498 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-04-28 11:17:49 48498 [Note] InnoDB: Memory barrier is not used
2020-04-28 11:17:49 48498 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-04-28 11:17:49 48498 [Note] InnoDB: Using CPU crc32 instructions
2020-04-28 11:17:49 48498 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2020-04-28 11:17:49 48498 [Note] InnoDB: Completed initialization of buffer pool
2020-04-28 11:17:49 48498 [Note] InnoDB: Highest supported file format is Barracuda.
2020-04-28 11:17:49 48498 [Note] InnoDB: 128 rollback segment(s) are active.
2020-04-28 11:17:49 48498 [Note] InnoDB: Waiting for purge to start
2020-04-28 11:17:49 48498 [Note] InnoDB: 5.6.47 started; log sequence number 1603477
2020-04-28 11:17:49 48498 [ERROR] /usr/local/opt/[email protected]/bin/mysqld: unknown variable 'mysqlx-bind-address=127.0.0.1'
2020-04-28 11:17:49 48498 [ERROR] Aborting
然后,我按照这个帖子。无法打开mysql.plugin表。请运行mysql_upgrade来创建它。并运行以下命令。
/usr/local/Cellar/mysql\@5.6/5.6.47/bin/mysqld --initialize-insecure
但我还是看到同样的错误。
编辑:我找到了my.cnf文件,它位于usrlocaletc内。
我找到了my.cnf文件,它位于usrlocaletc里面。
我删除了mysqlx-bind-address,现在我得到了以下错误。
2020-04-28 14:16:13 97501 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2020-04-28 14:16:35 98713 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
我已经解决了这个运行以下命令。
mysql_install_db --verbose --user=`whoami` --basedir=/usr/local/Cellar/mysql\@5.6/5.6.47 --datadir=/usr/local/var/mysql --tmpdir=/tmp
然后与 mysql.server start
,mysql DB服务器起来了,没有任何错误。谢谢。