Lỗi The MySQL server is currently offline

loi the mysql server is currently offline

cPanel báo lỗi “The MySQL server is currently offline”

“The MySQL server is currently offline; adminbin Cpanel/cpmysql/DBCACHE: exit 11

Error encountered while fetching data: can‘t create/write to file /run/tmp/#sql_244da_0.MAI (Errorcode: 2 “no such file or directory”) DBDISKUSED

 

Error encountered while fetching data: Can’t create/write to file ‘/run/tmp/#sql_1251_0.MAI’ (Errcode: 2 

“No such file or directory”) DBDISKUSED hoangnkyhx4q_wp371 1434667 DBDISKUSED hoangnkyhx4q_nguyennam 0 DBDISKUSED hoangnkyhx4q_stmstq 

980519 DISKUSED 2415186 DB hoangnkyhx4q_stmstq DBUSER hoangnkyhx4q_stmstq hoangnkyhx4q_stmstq 

DB hoangnkyhx4q_nguyennam DBUSER hoangnkyhx4q_nguyennam hoangnkyhx4q_nguyennam 

DB hoangnkyhx4q_wp371 

DBUSER hoangnkyhx4q_wp371 hoangnkyhx4q_wp371 

USER hoangnkyhx4q_stmstq Error encountered while fetching data: 

(XID d77n2h) The system received an error from the “MySQL” database “mysql”: 1 

(Can‘t create/write to file ‘/run/tmp/#sql_1251_0.MAI’ 

(Errcode: 2 “No such file or directory”))

Cách fix lỗi The MySQL server is currently offline

Đổi đường dẫn file tmp của mysql về /home/tmp

mkdir /home/tmp; chown mysql.mysql /home/tmp;

cd /home/tmp; chown mysql.mysql ..

Tạo 1 file và đưa nội dung này vào:

#https://support.cpanel.net/hc/en-us/articles/360052156294-How-To-move-the-mysql-tmpdir-out-tmp-and-into-home

nano /etc/systemd/system/mariadb.service.d/override.conf

 

#Paste dòng này vào:

[Service]

ProtectHome=false

 

#Sau đó chạy lệnh reload lại cấu hình:

systemctl daemon-reload; service mysqld restart;

Đổi đường dẫn của tmpdir trong /etc/my.cnf:

#Trong /etc/my.cnf:

[mysqld]

 

#Đổi từ:

#tmpdir=/run/tmp/

#đổi thành:

tmpdir=/home/tmp/

Kiểm tra xem mysql đã load đúng đường dẫn tmp chưa:

[root@root ~]# mysqladmin variables|grep tmpdir

| innodb_tmpdir        |

| slave_load_tmpdir    | /home/tmp/

| tmpdir               | /home/tmp/

 

The MySQL server is currently offline

 

[root@root ~]#


Cần check log mysql, nếu vẫn báo lỗi này là permission chưa được, và mysql đang running, nhưng sẽ lỗi InnoDB, toàn bộ bảng dùng InnoDB sẽ bị lỗi:

202011-05 22:31:24 0 

[ERROR] mysqld: Can‘t create/write to file ‘/home/tmp/ibQHAhgT‘ (Errcode: 13 “Permission denied”)

[ERROR] InnoDB: Unable to create temporary file; errno: 13

[ERROR] InnoDB: Plugin initialization aborted with error Generic error

[Note] InnoDB: Starting shutdown…

[ERROR] Plugin ‘InnoDB’ init function returned error.

[ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.

[Note] Plugin ‘FEEDBACK‘ is disabled.

[ERROR] Could not open mysql.plugin table. Some plugins may be not loaded

[ERROR] Can’t open and lock privilege tables: Unknown storage engine ‘InnoDB’

Kiểm tra xem InnoDB đã được Yes ở cột “Support” chưa:

MariaDB [(none)]> show engines;

+——————–+———+———————————————————————————-+————–+——+————+

| Engine             | Support | Comment                                                                          | Transactions | XA   | Savepoints |

+——————–+———+———————————————————————————-+————–+——+————+

| MRG_MyISAM         | YES     | Collection of identical MyISAM tables                                            | NO           | NO   | NO         |

| CSV                | YES     | Stores tables as CSV files                                                       | NO           | NO   | NO         |

| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables                        | NO           | NO   | NO         |

| MyISAM             | DEFAULT | Non-transactional engine with good performance and small data footprint          | NO           | NO   | NO         |

| Aria               | YES     | Crash-safe tables with MyISAM heritage                                           | NO           | NO   | NO         |

| InnoDB             | YES     | Supports transactions, row-level locking, foreign keys and encryption for tables | YES          | YES  | YES        |

| PERFORMANCE_SCHEMA | YES     | Performance Schema                                                               | NO           | NO   | NO         |

| SEQUENCE           | YES     | Generated tables filled with sequential values                                   | YES          | NO   | YES        |

+——————–+———+———————————————————————————-+————–+——+————+

8 rows in set (0.000 sec)

MariaDB [(none)]>

Đặc biệt lưu ý: Mỗi lần reboot lại server này, cần kiểm tra lại InnoDB engines

Như vậy là DataOnlien đã hướng dẫn xong cách Fix lỗi “The MySQL server is currently offline”. Nếu đã làm theo hướng dẫn mà không fix được, xin vui lòng liên hệ bộ phận kỹ thuật tại DataOnline.

Cảm ơn Bạn!

Để lại một bình luận

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *