mac mysql无法启动-查看错误日志

问题描述:
打开mysql workbench,显示无法连接。
在终端启动,也报错。

sudo /usr/local/mysql/support-files/mysql.server start

报错内容:

Starting MySQL
.Logging to '/opt/mysql/data/MacBook-Air.local.err'.
 ERROR! The server quit without updating PID file (/opt/mysql/data/MacBook-Air.local.pid).

使用chmod命令给mysql文件夹赋予权限

sudo chmod 777 /usr/local/mysql/

重新启动mysql。
若还是同样的错误,则可查看错误日志/usr/local/mysql/data/mysqld.local.err。找到最新的日志,根据报错内容解决问题。
例:此次报错为

2021-03-29T08:26:36.420671Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.21) starting as process 83688
2021-03-29T08:26:36.428356Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2021-03-29T08:26:36.429554Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2021-03-29T08:26:36.444654Z 0 [ERROR] [MY-011370] [Server] Plugin keyring_file reported: 'File '/usr/local/mysql/keyring/keyring' not found (OS errno 13 - Permission denied)'
2021-03-29T08:26:36.445867Z 0 [ERROR] [MY-011355] [Server] Plugin keyring_file reported: 'keyring_file initialization failure. Please check if the keyring_file_data points to readable keyring file or keyring file can be created in the specified location. The keyring_file will stay unusable until correct path to the keyring file gets provided'
2021-03-29T08:26:36.445996Z 0 [ERROR] [MY-010202] [Server] Plugin 'keyring_file' init function returned error.
2021-03-29T08:26:36.454101Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-03-29T08:26:36.826360Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-03-29T08:26:36.974873Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock
2021-03-29T08:26:36.992670Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...
2021-03-29T08:26:37.008506Z 0 [System] [MY-010232] [Server] XA crash recovery finished.
2021-03-29T08:26:37.033705Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-03-29T08:26:37.034309Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-03-29T08:26:37.041856Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/usr/local/mysql/data' in the path is accessible to all OS users. Consider choosing a different directory.
2021-03-29T08:26:37.102256Z 0 [System] [MY-010931] [Server] /usr/local/mysql/bin/mysqld: ready for connections. Version: '8.0.21'  socket: '/tmp/mysql.sock'  port: 3306  MySQL Community Server - GPL.

其中为【ERROR】信息为

  • Plugin keyring_file reported: ‘File ‘/usr/local/mysql/keyring/keyring’ not found (OS errno 13 - Permission denied)’
  • Plugin keyring_file reported: ‘keyring_file initialization failure. Please check if the keyring_file_data points to readable keyring file or keyring file can be created in the specified location. The keyring_file will stay unusable until correct path to the keyring file gets provided’
  • Plugin ‘keyring_file’ init function returned error.

检查是否存在keyring这个文件,若不存在就创建,若已存在则对它赋予权限

sudo chmod 777 /usr/local/mysql-8.0.21-macos10.15-x86_64/keyring/keyring

我在这一步已解决。
若还报错,还可以使用ps命令检查是否已经存在mysql进程

ps -ef | grep mysqld

若有,则使用kill -9 进程号来杀死这个进程即可。
另外,也可查看记载mysqld进程pid的文件/usr/local/mysql/data/mysqld.local.pid

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

茶如影

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值