mac mysql 使用注意事项
mac mysql 使用注意事项
1、安装
直接通过下载官网上的dmg安装包进行安装,mysql-5.5.49-osx10.8-x86_64(我的安装文件)
,安装完成后在系统偏好设置里面有mysql选项,我们可以通过这个启动和停止mysql服务器,默认安装在了
/usr/local/mysql 目录
2、启动
通过系统偏好设置启动项启动
通过/usr/local/mysql/support-files/mysql.server 启动
这两种启动方式有些地方需要注意,我们安装mysql后没有进行任何配置,使用默认配置,所有的mysql生成的
数据都在安装目录的data目录下,包括我们创建的数据库,log文件,pid文件。
对于log文件和pid文件,我们上面两种启动方式,对应的文件是不同的。通过偏好设置启动,对应的文件名是,
mysqld.local.pid 和 mysqld.local.err ,而通过第二种方式mysql.server启动,对应的文件是
staffdeMac-mini-2.local.err 和 staffdeMac-mini-2.local.pid,而且什么方式启动的就必须用相同的
方式关闭,不能够互相操作。
3、 ERROR! MySQL server PID file could not be found!
我先通过系统偏好启动,然后用另一种方式关闭,就会导致这个错误,因为两种方式的pid文件不同。
解决方法:
This question is a bit outdated but I thought I'd post how I resolved this issue when it happened to me on my Mac (OS X El Capitan 10.11.4). Check the status just to be sure mysql.server status ERROR! MySQL is running but PID file could not be found Find all running mysql processes ps aux | grep mysql It will list out all the processes using mysql (including the command you just executed) Kill off all the mysql pids sudo kill <pid1> <pid2> <pid3> ... This should kill off all the mysql processes Now try to fire mysql up mysql.server start Starting MySQL . SUCCESS! Hope this helps someone!
参考:
ERROR! MySQL server PID file could not be found!
浙公网安备 33010602011771号