我在自己的mac笔记本上装了一个docker,并在docker容器中安装了lnmp环境,经常会遇到在使用"lnmp restart"命令启动lnmp服务的时候,mysql服务启动失败,启动日志:

Stoping LNMP...
Stoping nginx... nginx is not running.
ERROR! MySQL server PID file could not be found!
Gracefully shutting down php-fpm /etc/init.d/php-fpm: line : kill: () - No such process
................................... failed. Use force-quit
Starting LNMP...
Starting nginx... done
Starting MySQL... ERROR! The server quit without updating PID file (/usr/local/mysql/var/37815a453e3e.pid).
Starting php-fpm done

找到mysql的数据存放目录,我的是/usr/local/mysql/var目录下(这个目录可以通过/etc/my.cnf中的innodb_data_home_dir属性查看),找到以.err结尾对文件,根据日期查看最近对err文件:

[root@37815a453e3e bin]# cd /usr/local/mysql/var
[root@37815a453e3e var]# ll
total
-rw-r----- mysql mysql Sep : 124dc886567c.err
-rw-r----- mysql mysql Sep : 22415a597457.err
-rw-r----- mysql mysql Oct : 37815a453e3e.err
-rw-r----- mysql mysql Sep : 7f92c9fbcaea.err
-rw-r----- mysql mysql Sep : f25f067a6a86.err

发现错误日中有如下错误信息:

--01T14::.741954Z  [Warning] Insecure configuration for --pid-file: 
  Location '/usr/local/mysql/var' in the path is accessible to all OS users.
  Consider choosing a different directory.
--01T14::.744299Z [ERROR] Fatal error: Can't open and lock privilege tables:
  Table storage engine for 'proxies_priv' doesn't have this option
--01T14::.744399Z [ERROR] Aborting

解决办法,对数据目录授权:

[root@6e1de98da6d4 var]# chown -R mysql:mysql /usr/local/mysql/var/
[root@6e1de98da6d4 var]# lnmp mysql restart
+-------------------------------------------+
| Manager for LNMP, Written by Licess |
+-------------------------------------------+
| https://lnmp.org |
+-------------------------------------------+
ERROR! MySQL server PID file could not be found!
Starting MySQL. SUCCESS!
[root@6e1de98da6d4 var]#

重启mysql服务,启动OK:

[root@37815a453e3e var]# lnmp mysql restart
+-------------------------------------------+
| Manager for LNMP, Written by Licess |
+-------------------------------------------+
| https://lnmp.org |
+-------------------------------------------+
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!


最新文章

  1. 【PRINCE2是什么】PRINCE2认证之七大原则(6)
  2. ZOJ Problem Set - 1201 Inversion
  3. linux 安装jdk
  4. [开发笔记]-jQuery获取checkbox选中项等操作及注意事项
  5. [转载]cin、cin.get()、cin.getline()、getline()、gets()函数的用法
  6. 从spring官网下载spring 架包
  7. 高性能mysql(一)
  8. 201521123060 《Java程序设计》第13周学习总结
  9. 从has no method 'tmpl'谈起
  10. webService(一)开篇
  11. Python面向对象 组合(选课系统示例)
  12. Python规范
  13. HTML入门11
  14. docker配置phpadmin需要注意的地方
  15. ubuntu18.04 安装 php7.2
  16. PHPEXCEL xls模板导入,及格式自定义:合并单元格、加粗、居中等操作
  17. 打开文件或者uri的方式--------进程启动文件和启动者启动文件
  18. 支付宝对账单下载Java沙箱调用
  19. Python之函数——进阶篇
  20. C++虚函数原理

热门文章

  1. 利用Webpack+React(antd)+ES6+python(flask)实现代码转换
  2. 【C#】Convert.ToInt32、(int)和int.Parse三者的区别
  3. 英语口语练习系列-C32-建筑-述说时间-暮秋独游曲江
  4. C#中的集合之ArryList
  5. 潭州课堂25班:Ph201805201 爬虫高级 第八课 AP抓包 SCRAPY 的图片处理 (课堂笔记)
  6. 直接存储器存取(Direct Memory Access,DMA)详细讲解
  7. 考前停课集训 Day2 非
  8. C++程序设计方法5:接口设计实例
  9. 基于WebSocket实现聊天室(Node)
  10. Python ----pip安装模块提示“unknown or unsupported command install”的解决办法