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

    73
    5
    8
    Feb 20, 2016
    Ratings:
    +10
    Local Time:
    2:38 PM
    1.10.1
    10.0
    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

    30,155
    6,782
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,133
    Local Time:
    5:38 PM
    Nginx 1.13.x
    MariaDB 5.5
    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).