https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15664
--- Comment #6 from Rudolf Byker <[email protected]> --- Another option is to use sed to replace the USE and CREATE DATABASE commands using regular expressions. This can be done using pipes, without creating a new dump. I wrote this bash function a while ago, which imports a gzipped Koha sql-dump. The first argument is the name of the database you want to create, and the second argument is the file name to import from. function import_db { DB="$1" F="$2" # Change the database names when importing. REPLACE1="s/^CREATE DATABASE.*/CREATE DATABASE ${DB};/" REPLACE2='s/USE `koha_rsc`;/USE `'"${DB}"'`;/' # Can't import if it exists, so drop it. drop_db "$DB" echo "Importing database $DB from $F …" zcat "${F}" | sed "${REPLACE1}; ${REPLACE2}" | mysql -u "$MYSQL_USER" -p"$MYSQL_PASS" } -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
