All Posts Tagged With: "putty"

Cik daudz aizņem mana mapīte

Iet runa par cilvēkiem :) Gribas redzēt MB, GB utt.

du –max-depth=1 -h -x -c

Kā atrast php.ini

php -i | grep php.ini

[root@mafia ~]# php -i | grep php.ini
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini
[root@mafia ~]#

Remote MYSQL database copy with ssh and Putty

How Copy a MySQL database from one Linux server to another Linux server?

You can copy MySQL database from one  LINUX server to another LINUX server using ssh or mysql client, but…

I recommend this Linux console program / Putty command (works on Linux platforms):

$ mysqldump -u username -p'password' old-db-name | ssh user@remote-server mysql -u username -p'password new-db-name

Remote MYSQL copy details

You can run all the above 3 commands in one pass using mysqldump and mysql commands. (WARNING! This is insecure method, use only if you are using VPN or trust your network):
$ mysqldump old-db-name | mysql -h remote-server new-db-name

Use ssh if you don’t have direct access to remote mysql server (secure method):
$ mysqldump old-db-name | ssh user@remote-server mysql new-db-name
OR
$ mysqldump -u username -p'password' old-db-name | ssh user@remote-server mysql -u username -ppassword new-db-name


You can just copy table called foo to remote database (and remote mysql server remote.box.com) called bar using same syntax:
$ mysqldump old-db-name foo | ssh user@remote-server mysql bar
OR
$ mysqldump -u user -p'password' db-name foo | ssh user@remote-server mysql -u user -p'password' db-name foo

This will not just save your time but you can impress your friend too ;). Almost all commands can be run using pipes under UNIX/Linux oses.

Kā iedot tiesības lai Crontab var izpildīt MySQL backup skriptu

  1. Uztaisam skriptu, kurš beckup MySQL
  2. Ieliekam to Crontab ar komandu crontab -e
  3. Lai skriptam būtu tiesības, izmantojam chmod +x

debian:/# ls -lat /home/scripts/mysql_backup.sh
-rw-r–r– 1 root root 2333 2010-08-20 13:25 /home/scripts/mysql_backup.sh
debian:/# chmod +x /home/scripts/mysql_backup.sh

Importējam lielas mysql datubāzes caur ssh klientu putty

Situācija ar MySQL datubāzes importu

  1. serveris ar linux
  2. shell pieeja caur ssh, izmatojam bezmaksas ssh klientu putty
  3. mysql db
  4. datu bāze ir virs 1000MB
  5. phpmyadmin atkrīt
  6. paliek ssh komandrinda
  7. rakstam mysql  -u lietotajvards -pslepena_parole telecomblog < telecomblog.sql
  8. ja viss norit veiksmīgi, tad šis darbiņš ir padarīts

Paskaidrojumi

  • telecomblog – datu bāzes nosaukums
  • telecomblog.sql – datu bāzes dump fails
  • slepena parole rakstās bez atstarpes, tieši aiz zīmes -p

Linux: du -h –max-depth=1

Reizem vajag uzzināt, cik lielas ir www apaķšdirektorijas, tai uzzinātu izmantojam komandu du -h –max-depth=1

  • telecomblog ~ # cd ..
  • telecomblog # cd www
  • telecomblog www #  du -h –max-depth=1

ja vajag noteikt direktorija lielumu, lietojam du -h –max-depth=1 direktorijas-nosaukums

Izmantotie: putty, gentoo, linux os