db/mysql

mysql cmd query

푸른바람 C/H 2017. 4. 20. 08:30

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


반응형

'db > mysql' 카테고리의 다른 글

Access denied; you need (at least one of) the SUPER privilege(s) for this operation  (0) 2018.04.02
Centos7 Mariadb datadir change  (0) 2018.03.07
mysql cmd query  (0) 2017.04.20
centos7 mysql5.7  (0) 2017.02.24
mysqladmin 퍼포먼스 정보 확인  (0) 2017.02.03
Shell 에서 MySQL 용량확인  (0) 2017.01.31