原因:

【2022/4/19】之前在安装时候遇到这个问题,后来不复现了。但是在我后续的折腾过程中这个问题还是复现了,当我用  systemctl start mysql 的时候我光标会卡在那儿一动不动,我处理的方法是重装,但是重装说实话也没啥用。

然后我看了状态,下图的现象其实mysql服务还在启动中并没有正常运行,应当看到running的状态,mysql才算启动了。可恶

然后尽量不要stop服务,尽量用systemctl restart mysql来重启服务,如果查服务一直是activating状态的时候需要等服务跑起来,不要瞎折腾。

当服务在activating状态的时候,使用登录命令会报2002 缺sock的错

启动后的端口应该是这个样子的

 

现象:

1.在服务器上安装好mysql之后启动报错

[root@10-7-14-25 ~]# systemctl status mysqld.service
● mysqld.service - MySQL Community Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: activating (start-post) since Wed 2022-03-30 15:19:17 CST; 8min ago
  Process: 14969 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
  Process: 14904 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 14969 (code=exited, status=0/SUCCESS);         : 14970 (mysql-systemd-s)
    Tasks: 2
   CGroup: /system.slice/mysqld.service
           └─control
             ├─14970 /bin/bash /usr/bin/mysql-systemd-start post
             └─17181 sleep 1

Mar 30 15:19:22 10-7-14-25 mysql-systemd-start[14904]: Note: new default config file not created.
Mar 30 15:19:22 10-7-14-25 mysql-systemd-start[14904]: Please make sure your config file is current
Mar 30 15:19:22 10-7-14-25 mysql-systemd-start[14904]: WARNING: Default config file /etc/my.cnf exists on the system
Mar 30 15:19:22 10-7-14-25 mysql-systemd-start[14904]: This file will be read by default by the MySQL server
Mar 30 15:19:22 10-7-14-25 mysql-systemd-start[14904]: If you do not want to use this, either remove it, or use the
Mar 30 15:19:22 10-7-14-25 mysql-systemd-start[14904]: --defaults-file argument to mysqld_safe when starting the server
Mar 30 15:19:22 10-7-14-25 mysqld_safe[14969]: 220330 15:19:22 mysqld_safe Logging to '/var/log/mysqld.log'.
Mar 30 15:19:22 10-7-14-25 mysqld_safe[14969]: 220330 15:19:22 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Mar 30 15:19:23 10-7-14-25 mysqld_safe[14969]: /usr/bin/mysqld_safe: line 183: 15137 Killed                  nohup /usr/sbin/mysqld --basedir=/usr --datadir=/v...
Mar 30 15:19:23 10-7-14-25 mysqld_safe[14969]: 220330 15:19:23 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
Hint: Some lines were ellipsized, use -l to show in full.

2.然后我过了一会儿我去查了一下mysql的log文件,发现好像启动了

[root@10-7-14-25 ~]# cat /var/log/mysqld.log 
220330 15:19:22 mysqld_safe Logging to '/var/log/mysqld.log'.
220330 15:19:22 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2022-03-30 15:19:23 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-03-30 15:19:23 0 [Note] /usr/sbin/mysqld (mysqld 5.6.51) starting as process 15137 ...
2022-03-30 15:19:23 15137 [Note] Plugin 'FEDERATED' is disabled.
2022-03-30 15:19:23 15137 [Note] InnoDB: Using atomics to ref count buffer pool pages
2022-03-30 15:19:23 15137 [Note] InnoDB: The InnoDB memory heap is disabled
2022-03-30 15:19:23 15137 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2022-03-30 15:19:23 15137 [Note] InnoDB: Memory barrier is not used
2022-03-30 15:19:23 15137 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-03-30 15:19:23 15137 [Note] InnoDB: Using Linux native AIO
2022-03-30 15:19:23 15137 [Note] InnoDB: Using CPU crc32 instructions
2022-03-30 15:19:23 15137 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2022-03-30 15:19:23 15137 [Note] InnoDB: Completed initialization of buffer pool
2022-03-30 15:19:23 15137 [Note] InnoDB: Highest supported file format is Barracuda.
2022-03-30 15:19:23 15137 [Note] InnoDB: 128 rollback segment(s) are active.
2022-03-30 15:19:23 15137 [Note] InnoDB: Waiting for purge to start
220330 15:19:23 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
220330 15:29:22 mysqld_safe Logging to '/var/log/mysqld.log'.
220330 15:29:22 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2022-03-30 15:29:23 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-03-30 15:29:23 0 [Note] /usr/sbin/mysqld (mysqld 5.6.51) starting as process 17889 ...
2022-03-30 15:29:23 17889 [Note] Plugin 'FEDERATED' is disabled.
2022-03-30 15:29:23 17889 [Note] InnoDB: Using atomics to ref count buffer pool pages
2022-03-30 15:29:23 17889 [Note] InnoDB: The InnoDB memory heap is disabled
2022-03-30 15:29:23 17889 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2022-03-30 15:29:23 17889 [Note] InnoDB: Memory barrier is not used
2022-03-30 15:29:23 17889 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-03-30 15:29:23 17889 [Note] InnoDB: Using Linux native AIO
2022-03-30 15:29:23 17889 [Note] InnoDB: Using CPU crc32 instructions
2022-03-30 15:29:23 17889 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2022-03-30 15:29:23 17889 [Note] InnoDB: Completed initialization of buffer pool
2022-03-30 15:29:23 17889 [Note] InnoDB: Highest supported file format is Barracuda.
2022-03-30 15:29:23 17889 [Note] InnoDB: 128 rollback segment(s) are active.
2022-03-30 15:29:23 17889 [Note] InnoDB: Waiting for purge to start
2022-03-30 15:29:23 17889 [Note] InnoDB: 5.6.51 started; log sequence number 1625987
2022-03-30 15:29:23 17889 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 1f233607-affb-11ec-ae65-525400ee5e4f.
2022-03-30 15:29:23 17889 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.
2022-03-30 15:29:23 17889 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
2022-03-30 15:29:23 17889 [Note] Server hostname (bind-address): '*'; port: 3306
2022-03-30 15:29:23 17889 [Note] IPv6 is available.
2022-03-30 15:29:23 17889 [Note]   - '::' resolves to '::';
2022-03-30 15:29:23 17889 [Note] Server socket created on IP: '::'.
2022-03-30 15:29:23 17889 [Note] Event Scheduler: Loaded 0 events
2022-03-30 15:29:23 17889 [Note] /usr/sbin/mysqld: ready for connections.

3.通过netstat查看一下服务器端口,启动了

[root@10-7-14-25 ~]# netstat -anp|grep 3306
tcp6       0      0 :::3306                 :::*                    LISTEN      17889/mysqld   

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐