I am installing MySQL8.0 on Ubuntu20.04, I updated apt before installing. Then I use the following command:
sudo apt install mysql-server
It says "Unable to start the server":
Warning: Unable to start the server.
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.
Job for mysql.service failed because a fatal signal was delivered to the control process.
See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: signal) since Tue 2022-03-01 18:47:38 UTC; 119ms ago
Process: 46667 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Process: 46685 ExecStart=/usr/sbin/mysqld (code=killed, signal=KILL)
Main PID: 46685 (code=killed, signal=KILL)
Status: "Server startup in progress"
dpkg: error processing package mysql-server-8.0 (--configure):
installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-8.0; however:
Package mysql-server-8.0 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Processing triggers for systemd (245.4-4ubuntu3.15) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.7) ...
Errors were encountered while processing:
mysql-server-8.0
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
MySQL is installed but I don't think it's successful. So I try to start the server:
sudo service mysql start
It returns:
Job for mysql.service failed because a fatal signal was delivered to the control process.
See "systemctl status mysql.service" and "journalctl -xe" for details.
"systemctl status mysql.service" shows:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: signal) since Tue 2022-03-01 19:00:36 UTC; 1min 52s ago
Process: 47280 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Process: 47288 ExecStart=/usr/sbin/mysqld (code=killed, signal=KILL)
Main PID: 47288 (code=killed, signal=KILL)
Status: "Server startup in progress"
Mar 01 19:00:35 ip-172-26-2-194 systemd[1]: mysql.service: Main process exited, code=killed, status=9/KILL
Mar 01 19:00:35 ip-172-26-2-194 systemd[1]: mysql.service: Failed with result 'signal'.
Mar 01 19:00:35 ip-172-26-2-194 systemd[1]: Failed to start MySQL Community Server.
Mar 01 19:00:36 ip-172-26-2-194 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 15.
Mar 01 19:00:36 ip-172-26-2-194 systemd[1]: Stopped MySQL Community Server.
Mar 01 19:00:36 ip-172-26-2-194 systemd[1]: mysql.service: Start request repeated too quickly.
Mar 01 19:00:36 ip-172-26-2-194 systemd[1]: mysql.service: Failed with result 'signal'.
Mar 01 19:00:36 ip-172-26-2-194 systemd[1]: Failed to start MySQL Community Server.
"journalctl -xe" shows:
-- Automatic restarting of the unit mysql.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Mar 01 19:00:36 ip-172-26-2-194 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 33416 and the job result is done.
Mar 01 19:00:36 ip-172-26-2-194 systemd[1]: mysql.service: Start request repeated too quickly.
Mar 01 19:00:36 ip-172-26-2-194 systemd[1]: mysql.service: Failed with result 'signal'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit mysql.service has entered the 'failed' state with result 'signal'.
Mar 01 19:00:36 ip-172-26-2-194 systemd[1]: Failed to start MySQL Community Server.
-- Subject: A start job for unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit mysql.service has finished with a failure.
--
-- The job identifier is 33416 and the job result is failed.
Mar 01 19:03:07 ip-172-26-2-194 sshd[47296]: error: kex_exchange_identification: Connection closed by remote host
I am not really understand what is "Failed with result 'signal'" and don't know what to do next. (I have tried purging and reinstalling, it doesn't work)
It's an Amazon Lightsail cloud server, which only has 512MB memory. I use "free" command and it shows that 176MB memory is available.
CodePudding user response:
A pretty minimum my.cnf
file, to reduce memory consumption of MySQL, could look like this:
[client]
port=3306
[mysql]
no-beep=
auto-rehash
[mysqld]
port=3306
datadir=D:/MySQL/Data
default-storage-engine=INNODB
report_port=3306
key_buffer_size=0M
tmp_table_size=1024
innodb_buffer_pool_size=5242880
innodb_log_buffer_size=262144
max_connections=5
sort_buffer_size=32768
read_buffer_size=8192
read_rnd_buffer_size=1
join_buffer_size=128
thread_stack=196K
binlog_cache_size=4096
Of course you should change, at least, the datadir=
setting to specify the location for your data.
With above config it is possible to start MySQL 8.0.28 (tested on Windows).
So @James: Change the settings in your my.cnf
, and MySQL should start on your
"Amazon Lightsail cloud server"