bash:mysql_migrate_server
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
bash:mysql_migrate_server [2013/12/16 19:49] – biggi | bash:mysql_migrate_server [2015/08/15 22:56] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 5: | Line 5: | ||
If you use it and make any changes, please send them to me (Biggi@Biggi.dk). Unfortunately comments and users are disallowed due to those retarded spam-bots always trying to rake in cash on every website, and I'm not about to spend an hour cleaning up this wiki once a week. | If you use it and make any changes, please send them to me (Biggi@Biggi.dk). Unfortunately comments and users are disallowed due to those retarded spam-bots always trying to rake in cash on every website, and I'm not about to spend an hour cleaning up this wiki once a week. | ||
- | <code - movesql.sh> | + | <file bash movesql.sh> |
#!/bin/bash | #!/bin/bash | ||
# TODO: | # TODO: | ||
# Write warning: sshpass 1.04 does not work. 1.05 required :/ | # Write warning: sshpass 1.04 does not work. 1.05 required :/ | ||
# Add option to use another port than 3306 and 22 | # Add option to use another port than 3306 and 22 | ||
+ | # DONE: | ||
+ | # 2013-12-17 - Ignoring ' | ||
+ | # 2013-12-17 - Flushing privileges at the end (to make sure new mysql permissions + passwords work) | ||
# Verify sshpass + mysqldump + pigz | # Verify sshpass + mysqldump + pigz | ||
Line 66: | Line 69: | ||
read -s dstsqlrootpwd | read -s dstsqlrootpwd | ||
- | echo " | + | echo " |
read dstuser | read dstuser | ||
- | echo " | + | echo " |
read -s dstpass | read -s dstpass | ||
Line 141: | Line 144: | ||
# Grab user data | # Grab user data | ||
- | for x in `mysql -u root --password=$sqlrootpwd -B -N -e"select | + | for x in `mysql -u root --password=$sqlrootpwd -B -N -e"SELECT |
UNAME=`echo $x | awk {' | UNAME=`echo $x | awk {' | ||
UHOST=`echo $x | awk {' | UHOST=`echo $x | awk {' | ||
Line 190: | Line 193: | ||
echo "* Importing sql user data on remote system"; | echo "* Importing sql user data on remote system"; | ||
- | IMPORPRIVILEGES=`sshpass -p " | + | IMPORTPRIVILEGES=`sshpass -p " |
echo "* Flushing privileges on remote system"; | echo "* Flushing privileges on remote system"; | ||
- | IMPORPRIVILEGES=`sshpass -p " | + | FLUSHPRIVILEGES=`sshpass -p " |
echo " ----------------------------"; | echo " ----------------------------"; | ||
Line 199: | Line 202: | ||
echo " ----------------------------"; | echo " ----------------------------"; | ||
- | </code> | + | </file> |
bash/mysql_migrate_server.1387219752.txt.gz · Last modified: 2015/08/15 22:56 (external edit)