11/25/2015 - 11:31 AM

SSH Commands

SSH Commands

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

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

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

//mysql commands

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

//login & create db, assign user  
mysql -u <username> -p;
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