Daily Archives: 07/11/2019

Mysql dump and restore on windows

Steps:

  1. Dump
    1. cd c:\program files\mariadb 10.4\bin
    2. mysqldump -u root -p –all-databases > d:\backup\dump20190712.sql
      Notice:

      1. Execute this command in “command promp” not in “mysql client”
      2. No “;” in the end!
  2. Restore
    1. mysql u username p dbname < filename.sql
    2. mysql -u root -p < backup.sql

Reference:

  1. https://john-dugan.com/dump-and-restore-mysql-databases-in-windows/
  2. https://code.yidas.com/mysqldump/

Page log sequence number error of MariaDB

Cause

After reinstall mariadb, replace all DB files in folder “data” directly could cause this error and service “MariaDB” will never started.

Solution

  1. Check error log:
    https://mariadb.com/kb/en/library/what-to-do-if-mariadb-doesnt-start/
    C:\Program Files\MariaDB 10.4\data\REX-PC.err
  2. Create an option file and put it in %WINDIR%/my.ini
    https://dev.mysql.com/doc/refman/8.0/en/option-files.html

    1. Why 6?
      https://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html
      https://mariadb.com/kb/en/library/innodb-recovery-modes/
  3. Run command to start mariadb: (under folder bin)
  4. You should be able to connect to DB server now
  5. Export tables in standard way.
  6. Uninstall DB server
  7. Install DB server