linux deploy下MySQL服务器启动失败解决方案:权限问题与网络配置优化

  1. 报错信息:
  2. 解决方案:

报错信息:

# 手工启动
┌──(root㉿localhost)-[/etc/init.d]
└─# ./mysqld restart
MySQL server PID file could not be found! ... failed!
Starting MySQL....The server quit without updating PID file (/www/server/data/localhost.pid). ... failed!
241206  3:38:10 [Note] Plugin 'FEDERATED' is disabled.
241206  3:38:10 InnoDB: The InnoDB memory heap is disabled
241206  3:38:10 InnoDB: Mutexes and rw_locks use GCC atomic builtins
241206  3:38:10 InnoDB: Compressed tables use zlib 1.2.11
241206  3:38:10 InnoDB: Initializing buffer pool, size = 256.0M
241206  3:38:10 InnoDB: Completed initialization of buffer pool
241206  3:38:10 InnoDB: highest supported file format is Barracuda.
241206  3:38:11  InnoDB: Waiting for the background threads to start
241206  3:38:12 InnoDB: 5.5.62 started; log sequence number 1595675
241206  3:38:12 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
241206  3:38:12 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
241206  3:38:12 [ERROR] Failed to create a socket for IPv4 '0.0.0.0': errno: 13.
241206  3:38:12 [ERROR] Can't create IP socket: Permission denied
241206  3:38:12 [ERROR] Aborting

241206  3:38:12  InnoDB: Starting shutdown...
241206  3:38:12  InnoDB: Shutdown completed; log sequence number 1595675
241206  3:38:12 [Note] /www/server/mysql/bin/mysqld: Shutdown complete

解决方案:

# 授予nginx、MySQL、php-fpm等组件必要的权限:
sudo usermod -a -G aid_inet,aid_net_raw mysql
sudo usermod -a -G aid_inet,aid_net_raw www

编辑 /etc/my.cnf 配置文件,在[mysqld]后面添加了一行

skip-networking

欢迎指出任何有错误或不够清晰的表达,可以在下面评论区评论。

×

喜欢就点赞,疼爱就打赏

//