Memperbaiki Database MySQL/MariaDB yang bermasalah.

Langkah memperbaiki Database MySQL/MariaDB yang bermasalah.

1. Edit file /etc/my.cnf dan tambahkan baris innodb_force_recovery = 1

Code (Text):
[mysqld]
innodb_force_recovery = 1

Bila masih gagal, ganti dengan angka 2 atau 3 dan seterusnya.


2. Aktipkan MySQL/MariaDB Server


Code (Text):
#service mysql restart


3. Masuk ke MySQL


Code (Text):
#msyql
Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 46560
Server version: 5.5.61-cll MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>



4. Export semua database :

Code (Text):
mysqldump --all-databases > /backup/alldatabases.sql


5. Hentikan MySQL/MariaDB Server

Code (Text):
mysqladmin flush-tables
sleep 240
mysqlstop


6. Salin semua folder mysql ke folder baru.


Code (Text):
rsync  -avz /var/lib/mysql /backup/


7. Hapsu folder mysql.

Code (Text):
cd /var/lib/mysql/
rm -rf /var/lib/mysql


8. Bangun ulang database MySQL/MariaDB

Code (Text):
mysql_install_db --user=mysql


9. Berikan mode 0755 ke folder yang terbentuk.


Code (Text):
chmod 0755 /var/lib/mysql

10. jangan lupa berikan comment atau hapus kode innodb_force_recovery = 1 di file /etc/my.cnf

Code (Text):
[mysqld]
#innodb_force_recovery = 1

11. Aktipkan MySQL/MariaDB

Code (Text):
#service mysql start


12.  rename file /root/.my.cnf

Code (Text):
mv /root/.my.cnf /root/disable.my.cnf



13. masuk ke  MySQL/MariaDB dan import backup sebelumnya

Code (Text):
mysql < /backup/alldatabases.sql


14. rename kembali /root/disable.my.cnf

Code (Text):
mv /root/disable.my.cnf /root/.my.cnf



15. Terakhir restart MySQL/MariaDB server

Code (Text):
service mysql restart




Comments

Popular posts from this blog

Persyaratan Domain .id Indonesia

Cara Upload file dengan Software FTP ke server hosting

Cara mengaktipkan CloudFlare di cpanel hosting agar websites lebih cepat diakses