在Mac OS X v10.6 (Snow Leopard)上,启动MySQL会出现以下错误:
服务器退出,没有更新PID文件
文件my.cnf
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16K
pid-file=/var/run/mysqld/mysqld.pid
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
我的回答很不专业,我不理解。我用的是CentOS和通用版的MySQL…当我用root用户启动mysql时,我的问题用——user=root解决了:
/path/to/mysql/support-files/mysql.server start --user=root
如果你正在使用systemctl启动mysql。服务,您需要更改mysql。/etc/systemd/system/mysql.service中的服务文件:
.
.
.
ExecStart=/path/tp/mysql/support-files/mysql.server start --user=root
ExecStop=/path/to/mysql/support-files/mysql.server stop --user=root
.
.
.
这是macOS中MySQL数据库最简单的“PID”错误解决方案:
执行如下命令:
$ sudo mysql.server start
Starting MySQL
.. SUCCESS!
使用此命令访问数据库:
$ mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 19
Server version: 8.0.31 Homebrew
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
Database |
information_schema |
mysql |
performance_schema |
sys |
4 rows in set (0.00 sec) |