MySQL Single instance failed at start

Hi Everyone,

I installed a single instance of MySQL server for testing on Ubuntu 18.04. Below are the parameters I set up with. The instance doesn’t start. Below is the error file content. Any suggestions?
journalctl -xe

-- The unit mysql.service has entered the 'failed' state with result 'exit-code'.

Apr 05 07:30:18 ubuntu-mysql systemd[1]: **Failed to start MySQL Community Server.**

-- Subject: A start job for unit mysql.service has failed

-- Defined-By: systemd
--

-- A start job for unit mysql.service has finished with a failure.

--

-- The job identifier is 3780 and the job result is failed.

Apr 05 07:30:18 ubuntu-mysql systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.

-- Subject: Automatic restarting of a unit has been scheduled

-- Defined-By: systemd

--

-- Automatic restarting of the unit mysql.service has been scheduled, as the result for

-- the configured Restart= setting for the unit.

Apr 05 07:30:18 ubuntu-mysql systemd[1]: Stopped MySQL Community Server.

-- Subject: A stop job for unit mysql.service has finished

-- Defined-By: systemd

-- Support: http://www.ubuntu.com/support

--

-- A stop job for unit mysql.service has finished.

--

-- The job identifier is 3855 and the job result is done.

Apr 05 07:30:18 ubuntu-mysql systemd[1]: **mysql.service: Start request repeated too quickly.**

Apr 05 07:30:18 ubuntu-mysql systemd[1]: **mysql.service: Failed with result 'exit-code'.**

-- Subject: Unit failed

-- Defined-By: systemd

--

-- The unit mysql.service has entered the 'failed' state with result 'exit-code'.

Apr 05 07:30:18 ubuntu-mysql systemd[1]: **Failed to start MySQL Community Server.**

-- Subject: A start job for unit mysql.service has failed

-- Defined-By: systemd

-- A start job for unit mysql.service has finished with a failure.

--
-- The job identifier is 3855 and the job result is failed.
--ERROR FILE
\f0\fs22 \cf2 \CocoaLigature0 2021-04-05T03:24:23.134306Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.23-0ubuntu0.20.04.1) initializing of server in progress as process 2747\
2021-04-05T03:24:23.140826Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.\
2021-04-05T03:24:23.408034Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.\
2021-04-05T03:24:24.366571Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.\
2021-04-05T03:24:25.052247Z 6 [System] [MY-013172] [Server] Received SHUTDOWN from user boot. Shutting down mysqld (Version: 8.0.23-0ubuntu0.20.04.1).\
2021-04-05T03:24:28.483211Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.23-0ubuntu0.20.04.1) starting as process 2812\
2021-04-05T03:24:28.497082Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.\
2021-04-05T03:24:28.635961Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.\
2021-04-05T03:24:28.714916Z 0 [ERROR] [MY-011292] [Server] Plugin mysqlx reported: 'Preparation of I/O interfaces failed, X Protocol won't be accessible'\
2021-04-05T03:24:28.715036Z 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of socket: '/var/run/mysqld/mysqlx.sock' failed, can't create lock file /var/run/mysqld/mysqlx.sock.lock'\
2021-04-05T03:24:28.843068Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.\
2021-04-05T03:24:28.843200Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.\
2021-04-05T03:24:28.844190Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.\
2021-04-05T03:24:28.858531Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.23-0ubuntu0.20.04.1'  socket: '/tmp/tmp.PIx0BNJUer/mysqld.sock'  port: 0  (Ubuntu).\
2021-04-05T03:24:28.885807Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.23-0ubuntu0.20.04.1).\
2021-04-05T03:24:30.325708Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.23-0ubuntu0.20.04.1)  (Ubuntu).\
2021-04-05T03:24:31.502492Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.23-0ubuntu0.20.04.1) starting as process 2877\
2021-04-05T03:24:31.510652Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.\
2021-04-05T03:24:31.647352Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.\
2021-04-05T03:24:31.730914Z 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of socket: '/var/run/mysqld/mysqlx.sock' failed, can't create lock file /var/run/mysqld/mysqlx.sock.lock'\
2021-04-05T03:24:31.731111Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '127.0.0.1' port: 33060\
2021-04-05T03:24:31.822172Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.\
2021-04-05T03:24:31.822303Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.\
2021-04-05T03:24:31.823836Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.\
2021-04-05T03:24:31.839302Z 7 [System] [MY-013172] [Server] Received SHUTDOWN from user boot. Shutting down mysqld (Version: 8.0.23-0ubuntu0.20.04.1).\
2021-04-05T03:24:33.240172Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.23-0ubuntu0.20.04.1)  (Ubuntu).\
2021-04-05T03:24:34.709501Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.23-0ubuntu0.20.04.1) starting as process 3096\
2021-04-05T03:24:34.717686Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.\
2021-04-05T03:24:34.862999Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.\
2021-04-05T03:24:34.947946Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '127.0.0.1' port: 33060, socket: /var/run/mysqld/mysqlx.sock\
2021-04-05T03:24:34.987729Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.\
2021-04-05T03:24:34.987860Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.\
2021-04-05T03:24:35.002284Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.23-0ubuntu0.20.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu).\
\
2021-04-05T04:23:00.795051Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.23-0ubuntu0.20.04.1).\
2021-04-05T04:23:02.193751Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.23-0ubuntu0.20.04.1)  (Ubuntu).\
2021-04-05T05:43:54.063971Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.23-0ubuntu0.20.04.1) starting as process 4992\
2021-04-05T05:43:54.072278Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.\
2021-04-05T05:43:54.227439Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.\
2021-04-05T05:43:54.307270Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '127.0.0.1' port: 33060, socket: /var/run/mysqld/mysqlx.sock\
2021-04-05T05:43:54.401030Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.\
2021-04-05T05:43:54.401163Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.\
2021-04-05T05:43:54.415286Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.23-0ubuntu0.20.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu).\
2021-04-05T05:52:07.832312Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.23-0ubuntu0.20.04.1).\
2021-04-05T05:52:08.809597Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.23-0ubuntu0.20.04.1)  (Ubuntu).\
}
1 Like

Here is config file: [mysql]

user=root

default-time-zone="-7:00"

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

pid-file=/var/run/mysqld/mysqld.pid

log-error=/var/log/mysql/mysqld.log

skip-log-bin

character_set_server=utf8

collation_server=utf8_general_ci

innodb_log_files_in_group=4

innodb_log_file_size=1G

innodb_log_buffer_size=1049000

innodb_buffer_pool_size=16G

innodb_buffer_pool_instances=1

innodb_io_capacity=1000

innodb_io_capacity_max=2500

innodb_read_io_threads=64

innodb_write_io_threads=64

innodb_flush_method=O_DIRECT_NO_FSYNC

innodb_flush_sync=OFF

max_prepared_stmt_count=65536

innodb_numa_interleave=1

sql_mode=NO_ENGINE_SUBSTITUTION

bind-address=X.X.X.X
1 Like

hi @alpikasingh
I have tried to reproduce your issue but without success.
I have install mysql 8.0.23, stopped mysql, added your cnf file. After that I started mysql and it started correctly.

● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2021-04-05 11:25:15 UTC; 14s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 4669 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 4719 (mysqld)
   Status: "Server is operational"
    Tasks: 158 (limit: 4915)
   CGroup: /system.slice/mysql.service
           └─4719 /usr/sbin/mysqld
Apr 05 11:25:12 ubuntu-bionic systemd[1]: Starting MySQL Community Server...
Apr 05 11:25:15 ubuntu-bionic systemd[1]: Started MySQL Community Server.

As per error message from your logfile:
2021-04-05T03:24:31.730914Z 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: ‘Setup of socket: ‘/var/run/mysqld/mysqlx.sock’ failed, can’t create lock file /var/run/mysqld/mysqlx.sock.lock’

Seems there are permission issues with /var/lib/mysqld directory

1 Like

Thank you. Can you please share the ownership settings at your end?