0

Unable to start mysql or mysqld.

Console says:

 (base) root@X-Public-Server:/# systemctl status mysql.service
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
(base) root@ELC-Public-Server:/# systemctl status mysql.service
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: deactivating (final-sigterm) since Fri 2022-04-22 00:31:18 UTC; 25min ago
  Process: 2349 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=killed, signal=TERM)
  Process: 2317 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 31447 (code=exited, status=0/SUCCESS)
    Tasks: 13 (limit: 4915)
   CGroup: /system.slice/mysql.service
           └─2352 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid

Apr 22 00:56:47 ELC-Public-Server systemd[1]: Starting MySQL Community Server...

(base) root@X-Public-Server:/# systemctl status mysqld.service
Unit mysqld.service could not be found.


(base) root@ELC-Public-Server:~# systemctl start mysql
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
(base) root@ELC-Public-Server:~#

I have tried uninstalling and reinstall mysql, as suggested here.

Also tried checking if the socket file mysql.sock is saved elsewhere, but it does not exist anywhere in the system server.

Ran journalctl -u mysql.service --since=today in the console to see status:

(base) root@ELC-Public-Server:/var/log/mysql# journalctl -u mysql.service --since=today
-- Logs begin at Wed 2022-04-20 18:27:15 UTC, end at Fri 2022-04-22 03:29:32 UTC. --
Apr 22 00:00:01 ELC-Public-Server systemd[1]: Stopped MySQL Community Server.
Apr 22 00:00:02 ELC-Public-Server systemd[1]: Starting MySQL Community Server...
Apr 22 00:00:03 ELC-Public-Server systemd[1]: Started MySQL Community Server.
Apr 22 00:00:05 ELC-Public-Server systemd[1]: Stopping MySQL Community Server...
Apr 22 00:00:09 ELC-Public-Server systemd[1]: Stopped MySQL Community Server.
Apr 22 00:00:09 ELC-Public-Server systemd[1]: Starting MySQL Community Server...
Apr 22 00:00:10 ELC-Public-Server systemd[1]: Started MySQL Community Server.
Apr 22 00:00:12 ELC-Public-Server systemd[1]: Stopping MySQL Community Server...
Apr 22 00:00:16 ELC-Public-Server systemd[1]: Stopped MySQL Community Server.
Apr 22 00:00:16 ELC-Public-Server systemd[1]: Starting MySQL Community Server...
Apr 22 00:00:17 ELC-Public-Server systemd[1]: Started MySQL Community Server.
Apr 22 00:00:19 ELC-Public-Server systemd[1]: Stopping MySQL Community Server...
Apr 22 00:00:23 ELC-Public-Server systemd[1]: Stopped MySQL Community Server.
Apr 22 00:00:23 ELC-Public-Server systemd[1]: Starting MySQL Community Server...
Apr 22 00:00:24 ELC-Public-Server systemd[1]: Started MySQL Community Server.
Apr 22 00:00:26 ELC-Public-Server systemd[1]: Stopping MySQL Community Server...
Apr 22 00:00:30 ELC-Public-Server systemd[1]: Stopped MySQL Community Server.

Also tried starting mysql.service:

(base) root@ELC-Public-Server:/var/log/mysql# systemctl start mysql.service
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.

Update: systemctl start mysql.service works; but mysql.service deactivates automatically. Here's my var/log/mysql/error.log:

2022-04-22T03:35:58.039614Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more$2022-04-22T03:35:58.041968Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.37-0ubuntu0.18.04.1) starting as process 20061 ...
2022-04-22T03:35:58.047273Z 0 [Note] InnoDB: PUNCH HOLE support available
2022-04-22T03:35:58.047301Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2022-04-22T03:35:58.047306Z 0 [Note] InnoDB: Uses event mutexes
2022-04-22T03:35:58.047310Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2022-04-22T03:35:58.047314Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-04-22T03:35:58.047319Z 0 [Note] InnoDB: Using Linux native AIO
2022-04-22T03:35:58.047711Z 0 [Note] InnoDB: Number of pools: 1
2022-04-22T03:35:58.047839Z 0 [Note] InnoDB: Using CPU crc32 instructions
2022-04-22T03:35:58.050070Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2022-04-22T03:35:58.060577Z 0 [Note] InnoDB: Completed initialization of buffer pool
2022-04-22T03:35:58.063670Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2022-04-22T03:35:58.075860Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2022-04-22T03:35:58.090044Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2022-04-22T03:35:58.090185Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2022-04-22T03:35:58.128613Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2022-04-22T03:35:58.129577Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2022-04-22T03:35:58.129596Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2022-04-22T03:35:58.130151Z 0 [Note] InnoDB: 5.7.37 started; log sequence number 8384821
2022-04-22T03:35:58.130435Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2022-04-22T03:35:58.130746Z 0 [Note] Plugin 'FEDERATED' is disabled.
2022-04-22T03:35:58.133352Z 0 [Note] InnoDB: Buffer pool(s) load completed at 220422  3:35:58
2022-04-22T03:35:58.138354Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2022-04-22T03:35:58.138378Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2022-04-22T03:35:58.138384Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2022-04-22T03:35:58.138388Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2022-04-22T03:35:58.138996Z 0 [Warning] CA certificate ca.pem is self signed.
2022-04-22T03:35:58.139035Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2022-04-22T03:35:58.139143Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2022-04-22T03:35:58.139163Z 0 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
2022-04-22T03:35:58.139206Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2022-04-22T03:35:58.147643Z 0 [Note] Event Scheduler: Loaded 0 events
2022-04-22T03:35:58.147842Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.37-0ubuntu0.18.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
2022-04-22T03:36:00.497947Z 0 [Note] Giving 1 client threads a chance to die gracefully
2022-04-22T03:36:00.497989Z 0 [Note] Shutting down slave threads
2022-04-22T03:36:02.498125Z 0 [Note] Forcefully disconnecting 1 remaining clients
2022-04-22T03:36:02.498191Z 0 [Warning] /usr/sbin/mysqld: Forcing close of thread 2  user: 'treasure-hunt'

2022-04-22T03:36:02.498296Z 0 [Note] Event Scheduler: Purging the queue. 0 events
2022-04-22T03:36:02.498583Z 0 [Note] Binlog end
2022-04-22T03:36:02.499112Z 0 [Note] Shutting down plugin 'auth_socket'
2022-04-22T03:36:02.499123Z 0 [Note] Shutting down plugin 'ngram'
2022-04-22T03:36:02.499127Z 0 [Note] Shutting down plugin 'partition'
2022-04-22T03:36:02.499146Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2022-04-22T03:36:02.499152Z 0 [Note] Shutting down plugin 'ARCHIVE'
2022-04-22T03:36:02.499155Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2022-04-22T03:36:02.499196Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2022-04-22T03:36:02.499201Z 0 [Note] Shutting down plugin 'MyISAM'
Yashvi
  • 45
  • 7
  • `mysqld.service` != `mysql.service`. IT, its all about attention to detail. – danblack Apr 22 '22 at 02:01
  • Yes @danblack. Neither mysqld nor mysql are working for me. How do i fix it?? – Yashvi Apr 22 '22 at 03:17
  • `systemctl status mysql.service` showing it `deactivating`. So for some reason doing a slow (25min+) shutdown. The mysql.socket is one of the first things removed on shutdown. Use `journalctl -u mysql.service --since=today` to see what is going on. Edit this info into your question if you have troubles. `systemctl start mysql.service` will start it, or should. Hard to say the state of the install when a 10year old uninstall/reinstall was followed. – danblack Apr 22 '22 at 03:25
  • @danblack thanks for the suggestion! I updated the question with the console logs – Yashvi Apr 22 '22 at 03:33

0 Answers0