$ mysql.server start# 启动失败 /usr/local/mysql/data 未创建Starting MySQL./usr/local/Cellar/mysql/8.0.28_1/bin/mysqld_safe: line 653: /usr/local/mysql/data/starrydeMacBook-Pro.local.err: No such file or directoryLogging to '/usr/local/mysql/data/starrydeMacBook-Pro.local.err'./usr/local/Cellar/mysql/8.0.28_1/bin/mysqld_safe: line 144: /usr/local/mysql/data/starrydeMacBook-Pro.local.err: No such file or directory/usr/local/Cellar/mysql/8.0.28_1/bin/mysqld_safe: line 199: /usr/local/mysql/data/starrydeMacBook-Pro.local.err: No such file or directory/usr/local/Cellar/mysql/8.0.28_1/bin/mysqld_safe: line 916: /usr/local/mysql/data/starrydeMacBook-Pro.local.err: No such file or directory/usr/local/Cellar/mysql/8.0.28_1/bin/mysqld_safe: line 144: /usr/local/mysql/data/starrydeMacBook-Pro.local.err: No such file or directoryERROR! The server quit without updating PID file (/usr/local/mysql/data/starrydeMacBook-Pro.local.pid).# 执行以下命令mysqld --initialize-insecure# 再次启动mysql.server start# 启动失败Starting MySQL./usr/local/Cellar/mysql/8.0.28_1/bin/mysqld_safe: line 653: /usr/local/mysql/data/starrydeMacBook-Pro.local.err: Permission deniedLogging to '/usr/local/mysql/data/starrydeMacBook-Pro.local.err'./usr/local/Cellar/mysql/8.0.28_1/bin/mysqld_safe: line 144: /usr/local/mysql/data/starrydeMacBook-Pro.local.err: Permission denied/usr/local/Cellar/mysql/8.0.28_1/bin/mysqld_safe: line 199: /usr/local/mysql/data/starrydeMacBook-Pro.local.err: Permission denied/usr/local/Cellar/mysql/8.0.28_1/bin/mysqld_safe: line 916: /usr/local/mysql/data/starrydeMacBook-Pro.local.err: Permission denied/usr/local/Cellar/mysql/8.0.28_1/bin/mysqld_safe: line 144: /usr/local/mysql/data/starrydeMacBook-Pro.local.err: Permission deniedERROR! The server quit without updating PID file (/usr/local/mysql/data/starrydeMacBook-Pro.local.pid).# 授权sudo chmod -R 777 /usr/local/mysql/data# 再次启动mysql.server start# 启动失败Starting MySQL... ERROR! The server quit without updating PID file (/usr/local/mysql/data/starrydeMacBook-Pro.local.pid).# 查看错误日志cd /usr/local/mysql/datacat XXXX-Pro.local.err
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
意味着:
mysql.sock
不存在于 /var/lib/mysql/