db/mysql
mysql cmd query
C/H
2017. 4. 20. 08:30
- MySQL/MariaDB: Run SQL Queries From A Shell Prompt / Command Line
- MySQL dump by query
- How to dump result of a sql query into a file
- mysqldump 옵션 스키마, 데이터만 백업
mysql -u user -p PASSWORD -e 'Execute sql query' database_name mysql -uUESRNAME -pPASSWORD -h MYSQLSERVERNAME --port=3306 -e 'show tables;' database_name +-----------------------------+ | Tables_in_database_name | +-----------------------------+ | access_keys | +-----------------------------+ mysqldump -uUESRNAME -pPASSWORD DATABASE_NAME TABLE_NAME -C --where='created < "2017-01-01"' > DATABASE.TABLE.20170101.sql mysqldump -uUESRNAME -pPASSWORD DATABASE_NAME TABLE_NAME -C --where='created < "2017-01-01"' | gzip > DATABASE.TABLE.20170101.sql.gz
반응형