- connect to database
mysql --user=root mysql -p - create db user 'paja' for connecting to localhost and also from outside
CREATE USER 'paja'@'localhost' IDENTIFIED BY 'paja-password';
CREATE USER 'paja'@'%' IDENTIFIED BY 'paja-password'; - grant privileges to create databases with prefix 'paja_'
GRANT ALL PRIVILEGES ON `paja\_%` . * TO 'paja'@'localhost';
GRANT ALL PRIVILEGES ON `paja\_%` . * TO 'paja'@'%'; - modify /etc/mysql/my.cnf by comment line
bind-address = 127.0.0.1
that makes MySQL server listening only on localhost - test connection from localhost and from different host
mysql --user=paja -h localhost -p
mysql --user=paja -h myhost.address -p
Tuesday, December 11, 2012
Simple setting of MySQL server for user's prefix
Few MySQL commands that I need:
Friday, September 7, 2012
Perl modules
You have already met this
because sometimes you have to install perl modules in non-standard folders (e.g. you are not root at the machine). How to solve it?
There is guide how to install perl module to specified folder
http://modperlbook.org/html/3-9-1-Installing-Perl-Modules-into-a-Nonstandard-Directory.html
In few steps:
To test your module run
Can't locate PerlIO/gzip.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at ...
because sometimes you have to install perl modules in non-standard folders (e.g. you are not root at the machine). How to solve it?
There is guide how to install perl module to specified folder
http://modperlbook.org/html/3-9-1-Installing-Perl-Modules-into-a-Nonstandard-Directory.html
In few steps:
- download modle from http://www.cpan.org/
- run
perl Makefile.PL PREFIX=/your/folder
make
make install- export variable PERL5LIB to /your/folder/lib/perl/5.10.1
Now it should work.
To see what is in your @INC, run
perl -V
To test your module run
perl -Mmodule_name -e ''
Wednesday, December 14, 2011
disk information and format
It is quote common that you need information about disk. There are many commands (sometimes distribution depended) that can do that. Try following:
lshw -class disk
smartctl -i /dev/sda
hdparm -i /dev/sda
hwinfo --disk
ls /dev/disk/by-id
cat /proc/partitions
cat /proc/mdstat
To add new disk you just need
fdisk -l
parted /dev/sdb
(parted) mklabel GPT
(parted) mkpart primary 0% 100%
(parted) quit
mkfs.ext4 /dev/sdb1
tune2fs -m 0 /dev/sdb1
Add line to /etc/fstab
Friday, January 28, 2011
identify problem
If something does not work first look at logs :
But there are not only these logs (see /var/log folder).
For hardware identify what was determined :
There you easily find vendor or identification for hardware.
For software (run by command) try:
or use verbose output of command, often by:
For open files, see:
Mentioned utilities have many options, so try arguments. Use keywords from previous outputs to feed goog..
cat /var/log/syslog
dmesgBut there are not only these logs (see /var/log folder).
For hardware identify what was determined :
lsusb
lspci
lshal
lshwThere you easily find vendor or identification for hardware.
For software (run by command) try:
strace command
or use verbose output of command, often by:
command --verbose
For open files, see:
lsofMentioned utilities have many options, so try arguments. Use keywords from previous outputs to feed goog..
Wednesday, December 8, 2010
playing with linear raid and ext4
The goal is to create linear raid with ext4 array from 4 disks. Than add 5. disk and verify data.
Create linear raid from 4 disks
Make ext4fs
Mount array
Information about array
Set the system recognize the raid after the reboot
Upload test data, make md5 checksum
Add 5. disk and resize filesystem
Add device at /etc/mdadm/mdadm.conf and rescan (change list line)
Compare checksum
Checksums are the same.
Add line to /etc/fstab and test reboot.
Sometimes there are problems with assemble, look in
if there are not some dummy traits from one disk, that you can stop by
See also wiki
Create linear raid from 4 disks
$ sudo mdadm -v --create /dev/md0 -l linear -n 4 /dev/sdb /dev/sdc /dev/sdd /dev/sdeMake ext4fs
$ sudo mkfs.ext4 /dev/md0Mount array
$ sudo mkdir array
$ sudo mount /dev/md0 /media/arrayInformation about array
$ sudo mdadm --detail /dev/md0
$ cat /proc/mdstat Set the system recognize the raid after the reboot
$ sudo echo 'DEVICES /dev/sdb /dev/sdc /dev/sdd /dev/sde' >> /etc/mdadm/mdadm.conf
$ sudo mdadm --detail --scan >> /etc/mdadm.confUpload test data, make md5 checksum
$ cd /media/array/
$ wget http://cdimage.debian.org/debian-cd/5.0.7/amd64/iso-cd/debian-507-amd64-netinst.iso
$ md5sum debian-507-amd64-netinst.iso
971ddace926fc3f7765f595da5cce223 debian-507-amd64-netinst.isoAdd 5. disk and resize filesystem
$ mdadm --grow --add /dev/md0 /dev/sdf
$ sudo resize2fs /dev/md0Add device at /etc/mdadm/mdadm.conf and rescan (change list line)
Compare checksum
$ md5sum debian-507-amd64-netinst.iso
971ddace926fc3f7765f595da5cce223 debian-507-amd64-netinst.isoChecksums are the same.
Add line to /etc/fstab and test reboot.
Sometimes there are problems with assemble, look in
cat /proc/mdstat
if there are not some dummy traits from one disk, that you can stop by
mdadm --stop /dev/md_d0
See also wiki
Monday, December 6, 2010
esxi managing from console
See also: Robert Chase page
It is easy to use console of ESXi server and do some managing from it.
Get all virtual machines
Power off/on/reboot virtual machine with id 368
Get information about virtual machine with id 368
Delete all snapshots
Refresh datastore
Delete and add nfs datastore back
Running processes
Console screen
It is easy to use console of ESXi server and do some managing from it.
Get all virtual machines
vim-cmd vmsvc/getallvmsPower off/on/reboot virtual machine with id 368
vim-cmd vmsvc/power.off 368
vim-cmd vmsvc/power.on 368
vim-cmd vmsvc/power.reboot 368Get information about virtual machine with id 368
vim-cmd vmsvc/get.summary 368Delete all snapshots
vim-cmd vmsvc/snapshot.removeall 368Refresh datastore
esxcfg-nas -rDelete and add nfs datastore back
esxcfg-nas -d back
esxcfg-nas -a back --host IPADDRESS --share DIRECTORYRunning processes
esxtopConsole screen
dcui
Wednesday, September 15, 2010
apache2 modules
List of loaded modules:
List of compiled modules:
Apache2 version:
Disable module:
Enable module:
apache2ctl -t -D DUMP_MODULESList of compiled modules:
apache2 -lApache2 version:
apache2 -vDisable module:
a2dismod module_nameEnable module:
a2enmod module_name
Subscribe to:
Posts (Atom)