1.问题
- Mac 中 Mariadb 状态查询报错。
mysql.server status
ERROR! MariaDB is not running, but PID file exists
- Mariadb 无法关闭
mysql.server stop
ERROR! MariaDB server process #xxxx is not running!
- 此时 Mariadb 并没有关闭,依然可以进入数据库
mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.5.9-MariaDB Homebrew
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
2.解决方案
方案一
- 通过
brew services
管理 MariaDB
brew services start mariadb
brew services stop mariadb
方案二
- 指定
--user=
参数
mysql.server status --user=[my_current_user]
sudo mysql.server stop --user=[my_current_user]
[my_current_user]
指的是当前启动 MariaDB 的用户
sudo mysql.server start
sudo mysql.server status --user=root
SUCCESS! MariaDB running (4143)
sudo mysql.server status --user=root
Shutting down MariaDB
. SUCCESS!
参考文献
MariaDB is not running, but PID file exists
MAC安装、启动、初始化、完整卸载Mariadb(MySQL)
mariadb服务器:我无法通过mysql.server stop
停止服务器