error: Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘

博主的方案:重启服务器:

执行命令: reboot

即可就可解决 ,

或是查看mysql日志信息

2019-12-02 12:48:17 17096 [Note] Plugin 'FEDERATED' is disabled.
2019-12-02 12:48:17 17096 [Note] InnoDB: Using atomics to ref count buffer pool pages
2019-12-02 12:48:17 17096 [Note] InnoDB: The InnoDB memory heap is disabled
2019-12-02 12:48:17 17096 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-12-02 12:48:17 17096 [Note] InnoDB: Memory barrier is not used
2019-12-02 12:48:17 17096 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-12-02 12:48:17 17096 [Note] InnoDB: Using Linux native AIO
2019-12-02 12:48:17 17096 [Note] InnoDB: Using CPU crc32 instructions
2019-12-02 12:48:17 17096 [Note] InnoDB: Initializing buffer pool, size = 64.0M
InnoDB: mmap(68681728 bytes) failed; errno 12
2019-12-02 12:48:17 17096 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2019-12-02 12:48:17 17096 [ERROR] Plugin 'InnoDB' init function returned error.
2019-12-02 12:48:17 17096 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-12-02 12:48:17 17096 [ERROR] Unknown/unsupported storage engine: InnoDB
2019-12-02 12:48:17 17096 [ERROR] Aborting

是因为内存不足引起,所以我按照网上的方法修改了/etc/my.cnf

innodb_buffer_pool_size =64M  ///(默认是128 )

然后重启 重新加载配置:/etc/init.d/mysqld reload  ,再重启mysql: /etc/init.d/mysqld restart

 还有要说如果经常性内存不足可以考虑增加一个 swap 分区(类似windosw下的虚拟内存)

 添加swap分区的步骤:

2.1) dd if=/dev/zero of=/swapfile bs=1M count=1024
2.2) mkswap /swapfile
2.3) swapon /swapfile
2.4) 添加这行: /swapfile swap swap defaults 0 0 到 /etc/fstab

Mysql 5.5+ 错误InnoDB: mmap(136019968 bytes) failed; errno 12(问题解决看此文章)

https://blog.csdn.net/sxyandapp/article/details/77091007

SWAP分区的增加

Linux实例SWAP分区的配置和常见问题处理

https://help.aliyun.com/knowledge_detail/42534.html

Centos7.x修改swap虚拟内存

https://blog.csdn.net/xiaoyu19910321/article/details/90216383 

Linux下 swap分区 虚拟内存 的创建、调整、修改、挂载

https://blog.csdn.net/mouse_ts/article/details/51649091

在centos7上设置swap交换空间

https://blog.csdn.net/u011649691/article/details/80746366

问题是解决了,但过了几个小时,此问题又复现,这问题如何根本性解决,跪求哪个知道的大牛指点一二

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值