attiquer
11/25/2015 - 11:31 AM

SSH Commands

SSH Commands

//Upload file/folder to server:
sudo scp -P 2020 path/to/file.zip ssh root@185.55.79.28:/path/to/destination/

//To download:
sudo scp -P 2020 root@185.55.79.28:/path/to/source /path/to/destination

//zip a directory
 tar cvzf archive_name.tar.gz dirname/
 zip -r file_name.zip direname

//mysql commands

//show users, passwords:
SELECT user, host FROM mysql.user

//login & create db, assign user  
mysql -u <username> -p;
CREATE DATABASE <dbname>;
USE <dbname>;
CREATE user 'username' identified by 'password';
SELECT host, user, password FROM mysql.user;
GRANT ALL ON *.* TO 'username';
SHOW GRANTS FOR 'username';
//import db
mysql -u root -p -h host db_name < /var/www/leveninternet_smal.sql

//Export DB
mysqldump -u USERNAME -p ASSWORD DATABASENAME > downloaded_DB_Name.sql