Solution to mysql failure to start due to insufficient disk space in ubuntu

Solution to mysql failure to start due to insufficient disk space in ubuntu

Preface

Recently, I added two fields to a table in the database. Later, it prompted something like insufficient disk space. Then the database was disconnected, and I couldn't connect to it after that. Later, after thinking about it, I finally solved the problem. This experience was really terrifying. This article records the solution to the problem of mysql being unable to start due to insufficient disk space.

Here’s how

Operating system: Ubuntu. Insufficient disk space causes MySQL to fail to start, which can cause the following problems:

root@iZ28z558vv0Z:/etc/mysql# mysql -u root -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
root@iZ28z558vv0Z:/b# service mysql start
start: Job failed to start
root@iZ28z558vv0Z:/var/lib# service mysqld start
mysqld: unrecognized service

Solution: Find the mysql configuration file my.cnf:

root@iZ28z558vv0Z:/etc/mysql# ls
conf.d debian.cnf debian-start my.cnf
root@iZ28z558vv0Z:/etc/mysql# vi my.cnf

The datadir item in the file shows /var/lib/mysql

[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

Because the disk space is insufficient, we need to check the location where MySQL saves data, the usage of the disk space of datadir or tmpdir, and check the usage of the disk space of datadir:

root@iZ28z558vv0Z:/var# df /var
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda1 41151808 39038392 0 100% /

It can be seen from the above that the disk space availability is obviously 0, which is why mysql cannot be started. The problem can be solved by deleting other files in the /var directory to free up disk space, and then restarting the mysql service.

Summarize

The above is the full content of this article. I hope that the content of this article can be of some help to your study or work. If you have any questions, you can leave a message to communicate.

You may also be interested in:
  • MySQL uses frm files and ibd files to restore table data
  • MySQL export of entire or single table data
  • Solve the problem that the MySQL database crashes unexpectedly, causing the table data file to be damaged and unable to start
  • Why the disk space is not released after deleting data in MySQL
  • Common problems with the MySQL storage engine MyISAM (table corruption, inaccessibility, insufficient disk space)
  • How to turn off MySQL log to protect disk space under lnmp
  • Several suggestions for shrinking MySQL to save disk space
  • How to free up disk space after deleting data in Mysql InnoDB
  • Why is the disk space still occupied after deleting table data in MySQL?

<<:  JS implements click drop effect

>>:  How to isolate users in docker containers

Recommend

Detailed explanation of Grid layout and Flex layout of display in CSS3

Gird layout has some similarities with Flex layou...

WeChat applet implements search box function

This article example shares the specific code for...

Docker container introduction

1. Overview 1.1 Basic concepts: Docker is an open...

Example of CSS3 to achieve div sliding in and out from bottom to top

1. First, you need to use the target selector of ...

Summary of the characteristics of SQL mode in MySQL

Preface The SQL mode affects the SQL syntax that ...

Implementation of react loop data (list)

First, let's simulate the data coming from th...

Analysis of Linux Zabbix custom monitoring and alarm implementation process

Target Display one of the data in the iostat comm...

13 Most Frequently Asked Vue Modifiers in Interviews

Table of contents 1. lazy 2.trim 3.number 4.stop ...

Examples of using the ES6 spread operator

Table of contents What are spread and rest operat...

Install and deploy java8 and mysql under centos7

Generally, learning Java and deploying projects a...

How does Zabbix monitor and obtain network device data through ssh?

Scenario simulation: The operation and maintenanc...

Solution to MySQL startup successfully but not listening to the port

Problem Description MySQL is started successfully...

JavaScript implements circular carousel

This article shares the specific code of JavaScri...

Beginners learn some HTML tags (1)

Beginners can learn HTML by understanding some HT...