Archiwum dla Październik, 2011


Sometime I have this problem: Access denied for user ‚root’@’localhost’ (using password: NO) I have described solution below:

  • Start the mysql client process using this command (sudo /etc/init.d/mysql start):
    mysql -u root
  • Execute this command to be able to change any password:
    FLUSH PRIVILEGES;

    Then reset/update your password:

    SET PASSWORD FOR root@'localhost' = PASSWORD('password');

    If we have a mysql root account that can connect from everywhere, you should also do:

    UPDATE mysql.user SET Password=PASSWORD('newpassword') WHERE User='root';

    Alternate Method:

    USE mysql UPDATE user SET Password = PASSWORD('newpassword') WHERE Host = 'localhost' AND User = 'root';

    And if you have a root account that can access from everywhere:

    USE mysql UPDATE user SET Password = PASSWORD('newpassword') WHERE Host = '%' AND User = 'root';
  • Or faster:

USE mysql;
FLUSH PRIVILEGES;
UPDATE user SET Password = PASSWORD(‚dupa’) WHERE Host = ‚%’ AND User = ‚root’;

 

Then stop/restart the mysqld process:

sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start
or
sudo /etc/init.d/mysql restart
Reklamy

Copying data between tables:

 

INSERT INTO table SELECT * FROM base2.table;


Copying data between tables including fields list:

 

INSTER INTO client (client_id, word) SELECT 4, word FROM client WHERE client_id = 3;


Jak szybko stworzyć ładne conky w Ubuntu

Posted: 6 października 2011 in conky, Linux, Ubuntu
Tagi: , ,

Instalujemy conky:

sudo apt-get install conky

Tworzymy plik .conkyrc i zapisujemy w /home/user

background yes
font Snap.se:size=8
xftfont Snap.se:size=8
use_xft yes
xftalpha 0.1
update_interval 1.0
total_run_times 0
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
draw_shades yes
draw_outline no
draw_borders no
draw_graph_borders no
minimum_size 206 5
maximum_width 175
default_color 110000
default_shade_color 110000
default_outline_color 110000
alignment top_right
gap_x 15
gap_y 35
no_buffers yes
cpu_avg_samples 2
override_utf8_locale no
uppercase no # set to yes if you want all text to be in uppercase
use_spacer no

TEXT
${font LCD:style=Bold:pixelsize=40}${alignc}${time %H:%M}${font Snap.se:size=8}

${font Aerial:style=Bold:pixelsize=12}SYSTEM${font Snap.se:size=8} ${hr 1 }

System: $alignr$sysname
Kernel: $alignr$kernel
Uptime: $alignr$uptime
Processes: ${alignr}$processes ($running_processes running)
Load: ${alignr}$loadavg

${color slate grey}CPU 0:${alignr}:CPU 1
${color red}${cpu cpu1}%  ${freq_g cpu1}GHz$alignr${color red}${cpu cpu2}%  ${freq_g cpu2}GHz

${cpubar 4 cpu1}
${cpugraph ff0000 ffffff}

RAM ${alignr}$mem / $memmax ($memperc%)
${membar 4}

Highest CPU $alignr CPU% MEM%
${hr 1}
${top name 1}$alignr${top cpu 1}${top mem 1}
${top name 2}$alignr${top cpu 2}${top mem 2}
${top name 3}$alignr${top cpu 3}${top mem 3}

Highest MEM $alignr CPU% MEM%
${hr 1}
${top_mem name 1}$alignr${top_mem cpu 1}${top_mem mem 1}
${top_mem name 2}$alignr${top_mem cpu 2}${top_mem mem 2}
${top_mem name 3}$alignr${top_mem cpu 3}${top_mem mem 3}

${font Aerial:style=Bold:pixelsize=12}FILESYSTEM ${font Snap.se:size=8}${hr 1}

Root: ${alignr}${fs_free /} / ${fs_size /}
${fs_bar 4 /}

Home: ${alignr}${fs_free /home} / ${fs_size /home}
${fs_bar 4 /home}

${font Aerial:style=Bold:pixelsize=12}NETWORK ${font Snap.se:size=8}${hr 1}

Hostname: $alignr$nodename
IP: ${execi 5 ~/ip_zew}
Down ${downspeed eth0} k/s ${alignr}Up ${upspeed eth0} k/s
${downspeedgraph eth0 25,107 00ff00 ffffff} ${alignr}${upspeedgraph eth0 25,107 ff0000 ffffff}
Total ${totaldown eth0} ${alignr}Total ${totalup eth0}
$stippled_hr
$alignc${color orange}GMAIL$color
$stippled_hr
${execi 600 ~/gmail}

${color #ddaa00}Port(s)${alignr}#Connections
$color Inbound: ${tcp_portmon 1 32767 count} Outbound: ${tcp_portmon 32768 61000 count}${alignr}ALL: ${tcp_portmon 1 65535 count}
${color #ddaa00}Inbound Connection ${alignr} Local Service/Port$color
${tcp_portmon 1 32767 rhost 0} ${alignr} ${tcp_portmon 1 32767 lservice 0}
${tcp_portmon 1 32767 rhost 1} ${alignr} ${tcp_portmon 1 32767 lservice 1}
${tcp_portmon 1 32767 rhost 2} ${alignr} ${tcp_portmon 1 32767 lservice 2}
${color #ddaa00}Outbound Connection ${alignr} Remote Service/Port$color
${tcp_portmon 32768 61000 rhost 0} ${alignr} ${tcp_portmon 32768 61000 rservice 0}
${tcp_portmon 32768 61000 rhost 1} ${alignr} ${tcp_portmon 32768 61000 rservice 1}
${tcp_portmon 32768 61000 rhost 2} ${alignr} ${tcp_portmon 32768 61000 rservice 2}

Tworzymy plik gmail (w /home/user)

#!/bin/bash

gmail_login="user"
gmail_password="password"

dane="$(wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q -O - https://${gmail_login}:${gmail_password}@mail.google.com/mail/feed/atom --no-check-certificate | grep 'fullcount' | sed -e 's/.*<fullcount>//;s/</fullcount>.*//' 2>/dev/null)"

if [ -z "$dane" ]; then
   echo "Błąd połaczenia"
else
   let wynik=$dane;
   if [ $wynik = 0 ]; then
      echo "Nie masz nowych wiadomosci."
   elif [ $wynik = 1 ]; then
      echo "Masz 1 nową wiadomość."
   else
      if [ $wynik -lt 5 ]; then
         echo "Masz $wynik nowe wiadomości."
      else
         echo "Masz $wynik nowych wiadomości."
      fi
   fi
fi

Tworzymy plik ip_zew w /home/user (uruchomi conky po 20 sekundach od startu systemu)

#!/bin/bash myip=”$(wget http://checkip.dyndns.org -q -O – | sed ‚s/.*ss: //;s/</b.*//’)” echo $myip

Tworzymy plik autostart w /home/user

#!/bin/bash sleep 20 && conky

 

Aby conky uruchamiało się przy starcie klikamy System -> Preferencje -> Programy startowe i klikamy Dodaj i wskazujemy ścieżkę do pliku autostart

W rezultacie wyglądać będzie ono tak:

conky

conky