Last active
August 29, 2015 13:57
-
-
Save wwwbruno/9550954 to your computer and use it in GitHub Desktop.
Comandos básicos de MySql pelo terminal de comando
This file contains 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
# abrir o terminal do MySql | |
mysql -u root -p | |
# exportar uma tabela completa para um arquivo | |
mysqldump -p -u root nome_do_banco nome_da_tabela > nome_do_arquivo.sql | |
# rodar uma query a partir de um arquivo .sql | |
mysql -p -u root nome_do_banco < nome_do_arquivo.sql | |
# remover restrict | |
SET GLOBAL sql_mode = ''; | |
SET SESSION sql_mode = ''; | |
# checar sql_mode atual | |
SELECT @@GLOBAL.sql_mode; | |
SELECT @@SESSION.sql_mode; | |
# desabilitar checagem para importação | |
SET FOREIGN_KEY_CHECKS = 0; | |
SET UNIQUE_CHECKS = 0; | |
SET AUTOCOMMIT = 0; | |
# reabilitar checagem após importação | |
SET UNIQUE_CHECKS = 1; | |
SET FOREIGN_KEY_CHECKS = 1; | |
COMMIT; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment