Welcome to Centmin Mod Community
Become a Member

MariaDB Best way to import a mysql database

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by arlon, Feb 22, 2016.

  1. arlon

    arlon Member

    95
    6
    8
    Feb 20, 2016
    Ratings:
    +12
    Local Time:
    12:51 AM
    1.13.6
    10.1
    whats the best way to import database?
    i have database 110mb, i have tried using commpand line:
    gunzip < mydb.sql.gz | mysql -u nama_user1 -p [databasename]
    mysql -u [username] -p newdatabase < [database name].sql

    i don't know is my imprting successfull or not? since i didn't get any report or errorr report.. and then i ran the same import command and didn't get any error too (duplicate table maybe)

     
    Last edited: Feb 22, 2016
  2. eva2000

    eva2000 Administrator Staff Member

    55,189
    12,251
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,829
    Local Time:
    3:51 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    move your post to it's own thread in more appropriate forum :)

    @arlon

    For mysql backup and restore best to use mysqldump and mysql client commands respectively. And read MySQL :: MySQL 5.6 Reference Manual :: 7 Backup and Recovery For general management see Getting Started Guide step 11.

    Generally, the way is to use SSH commands below:

    backup
    Code:
    mysqldump -u mysqlusername -p mysqldatabasename > /path/to/mysqldatabasename_backup_date.sql
    restore
    Code:
    mysql -u mysqlusername -p mysqldatabasename < /path/to/mysqldatabasename_backup_date.sql
    If backup and/or restore commands work, then will return to command prompt without any message. To verify database is intact with all data, you need to inspect the database itself via phpmyadmin etc and/or use the database and compare to the original (inspect via phpmyadmin etc).