1 |
8291
|
aaronmk
|
#!/bin/bash -e
|
2 |
8774
|
aaronmk
|
. "$(dirname "${BASH_SOURCE[0]}")"/../../../lib/runscripts/import.run
|
3 |
9854
|
aaronmk
|
.rel ../../../lib/runscripts/subdir.run
|
4 |
|
|
.rel ../../../lib/sh/resume_import.sh
|
5 |
8285
|
aaronmk
|
|
6 |
8705
|
aaronmk
|
if self_not_included; then
|
7 |
|
|
|
8 |
9595
|
aaronmk
|
## to reload GBIF MySQL:
|
9 |
|
|
# $ database=GBIF_new path/to/this/file load_data
|
10 |
|
|
# rename GBIF->GBIF_old, GBIF_new->GBIF on vegbiendev using the steps at
|
11 |
|
|
# wiki.vegpath.org/MySQL_queries#Rename-database
|
12 |
|
|
# drop GBIF_old in phpMyAdmin (vegbiendev.nceas.ucsb.edu/phpmyadmin)
|
13 |
|
|
|
14 |
9589
|
aaronmk
|
dumpfile_stem=GBIFPortalDB-2013-02-20
|
15 |
|
|
dumpfile_stem_path="$top_dir/$dumpfile_stem"
|
16 |
|
|
|
17 |
|
|
load_data() # usage: [database=GBIF_new] load_data
|
18 |
|
|
{
|
19 |
|
|
echo_func
|
20 |
|
|
|
21 |
|
|
use_local_remote
|
22 |
|
|
database= mysql_root <<EOF
|
23 |
|
|
CREATE DATABASE IF NOT EXISTS $database DEFAULT CHARACTER SET utf8/*utf8_general_ci*/;
|
24 |
|
|
GRANT ALL PRIVILEGES ON $database.* TO '$local_user'@'%' WITH GRANT OPTION;
|
25 |
|
|
REVOKE UPDATE, DELETE, ALTER, DROP ON $database.* FROM '$local_user'@'%';
|
26 |
|
|
EOF
|
27 |
|
|
|
28 |
|
|
sql_preamble <"$top_dir"/../_src/"$dumpfile_stem".dump >"$dumpfile_stem_path".schema.0.preamble.sql
|
29 |
|
|
cat "$dumpfile_stem_path".schema*.sql|mysql_root
|
30 |
|
|
time cat "$dumpfile_stem_path".data*.sql|mysql_rm_privileged_statements\
|
31 |
|
|
|log_queries= mysql_local
|
32 |
|
|
}
|
33 |
|
|
|
34 |
9074
|
aaronmk
|
import()
|
35 |
8285
|
aaronmk
|
{
|
36 |
8881
|
aaronmk
|
echo_func
|
37 |
9506
|
aaronmk
|
top_make
|
38 |
8285
|
aaronmk
|
}
|
39 |
8705
|
aaronmk
|
|
40 |
|
|
fi
|