Topic List
โดย Little Bear on 9 ส.ค. 67 17:52
Backup database
Backup database all table
mysqldump --user=username --password databasename> file.sql
Backup database some table
mysqldump --user=username --password databasename table1 table2 > file.sql
Backup database exclude some table
mysqldump --user=username --password --databases db --ignore-table=db.table1 --ignore-table=db.table2 > file.sql
Repair database/table
For InnoDB Tables:
- Restart MariaDB with innodbforcerecovery by edit MariaDB configuration file (e.g., my.cnf or my.ini) and add or modify the innodbforcerecovery option in the [mysqld] section. Start with a low non-zero value (e.g., 1).
- Restart MariaDB. If it fails, increase the value and retry.
- Once MariaDB starts, you can try to dump the data from the corrupted table, drop the table, recreate it, and then restore the dumped data.
- Check and Optimize Tables: - Use mariadb-check -c databasename to check for corrupted indexes. - Run OPTIMIZE TABLE tablename to force a rebuild of the table.
For MyISAM Tables:
Use REPAIR TABLE statement:
REPAIR TABLE table_name;
You can add the FORCE argument to attempt internal repair before rebuilding:
REPAIR TABLE table_name FORCE;
Use myisamchk utility:
myisamchk -r table_name.MYI
4152 reads | เขียนความคิดเห็น | อ่านเพิ่มเติม navigate_next
tags version 4.00.00 release 18.9.21. ช่วยเหลือ