Created
October 6, 2011 13:49
-
-
Save squiter/1267437 to your computer and use it in GitHub Desktop.
Import MySQL dump to a database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
################################################## | |
#### Script para importar dumps de MySQL ######### | |
################################################## | |
# Configurações | |
# Onde está seu MySQL? | |
MySQL="/opt/local/bin/mysql5" | |
# Onde esá seu seu banco? | |
MyHost="localhost" | |
# Qual é o username do banco? | |
MyUser="root" | |
# E a senha? | |
MyPass="" | |
# Dentro de qual banco você quer colocar o dump? | |
MyDb="tvtribuna" | |
# Passar o endereço completo do arquivo.sql por parametro | |
SQLFile=$1 | |
# Não precisa mexer daqui pra baixo ;) | |
HavePass=$(echo ${#MyPass}) | |
if [ $HavePass -lt 1 ]; then | |
$MySQL -h $MyHost -u$MyUser $MyDb < $SQLFile | |
else | |
$MySQL -h $MyHost -u$MyUser -p$MyPass $MyDb < $SQLFile | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment