| Thanks to antville.org |
|
Saturday, 20. June 2009
tmpdir in MySQL
shantanuo
07:22h
In MySQL, the tmpdir path is mainly used for disk-based sorts (if the sort_buffer_size is not enough) and disk-based temp tables.
You can configure a slave with tmpdir=/dev/shm ... Link (0 comments) ... Comment Wednesday, 13. May 2009
Install SQLite
shantanuo
19:24h
$ # As of March 2009, the latest version was 3.6.11.
$ wget www.sqlite.org $ tar xzf sqlite-amalgamation-3.6.11.tar.gz $ cd sqlite-3.6.11 $ ./configure && make $ sudo make install ... Link (0 comments) ... Comment Monday, 11. May 2009
Using binlogs to update table
shantanuo
21:43h
It is very interesting to know about how to extract statements from binlogs.
mysqlbinlog --start-datetime="`date +%Y-%m-%d' '%H:00:00 -d\"1 hour ago\"`" --stop-datetime="`date +%Y-%m-%d' '%H:00:00`" mysql-bin.* | awk '/tbl_company/,/;/' | replace tbl_company mydb.tbl_company | mysql -h 172.29.0.0 -uroot -pPasswd mydb I have not tested it, but guess it should work as expected. ... Link (0 comments) ... Comment Monday, 4. May 2009
awk power
shantanuo
20:07h
$ cat salaries
Yvette van der Hoff 100000 Sarack Abama 400000 Bernie Madoff 0 John Q. Public 20000 $ awk '{print $NF, $0}' salaries | sort -nr -k1,1 | cut -d" " -f2- Sarack Abama 400000 Yvette van der Hoff 100000 John Q. Public 20000 Bernie Madoff 0 $ awk -F '\t' -v 'OFS=\t' '{print $4, $3, $5, $2, $1}' data.txt POP. COUNTY GOVT. CITY STATE 123 Gila Mayor Ely AZ 345 Lolo Sheriff Alma CA 22 El Paso Bubba Leroy TX ... Link (0 comments) ... Comment Sunday, 3. May 2009
skip networking in MySQL
shantanuo
21:04h
When there is maintenance work to be carried on the database server, you can simply skip networking so that no connection from any other server from the network will be accepted.
Simply enter the following in /etc/my.cnf: [mysqld] # Prevent network access to MySQL. skip-networking ... Link (0 comments) ... Comment Saturday, 2. May 2009
Saving data to text file
shantanuo
20:31h
sqlite> .mode list
sqlite> .separator | sqlite> .output test_file_1.txt sqlite> select * from tbl1; sqlite> .exit $ cat test_file_1.txt hello|10 goodbye|20 $ ... Link (0 comments) ... Comment Thursday, 30. April 2009
Silent mode in Linux
shantanuo
12:51h
Sick of your computer speaker beeping like a demented Morse code machine whenever you type something wrongly? Teach it the sound of silence: run the command
setterm -blength 0 to mute the alarm bell no matter what kind of terminal you're typing into. If you want it to happen every time you start a terminal, just add the command to your .bash_profile file. ... Link (0 comments) ... Comment Monday, 13. April 2009
valid date
shantanuo
15:44h
validdate.sh script will look like this...
#!/bin/sh userdate=$1 date -d $userdate &> /dev/null if [ $? -ne 0 ] ; then echo You entered an invalid date, $userdate else echo The date $userdate is valid fi # sh validdate.sh 2009-33-44 You entered an invalid date, 2009-33-44 ... Link (0 comments) ... Comment Tuesday, 7. April 2009
IP addresses from access log
shantanuo
12:04h
generate a list of IP address along with the number of times each was encountered and sort
cat access_log | awk '{print $1}' | sort | uniq -c | sort -nr ... Link (0 comments) ... Comment Monday, 6. April 2009
Backup a directory
shantanuo
15:47h
#!/bin/sh
tar czvf $1.$(date +%Y%m%d-%H%M%S).tgz $1 exit $? The arc script accepts a single file or directory name as a parameter and creates a compressed archive file with the current date embedded into the resulting archive file's name. ... Link (0 comments) ... Comment ... Next page
|
Online for 2506 days
Last modified: 2009.06.20, 07:22 Status
Youre not logged in ... Login
Menu
Search
Calendar
Recent updates
tmpdir in MySQL In MySQL,
the tmpdir path is mainly used for disk-based sorts (if...
by shantanuo (2009.06.20, 07:22)
Install SQLite $ # As
of March 2009, the latest version was 3.6.11.
$ wget...
by shantanuo (2009.05.13, 19:24)
Using binlogs to update table
It is very interesting to know about how to extract...
by shantanuo (2009.05.11, 21:43)
awk power $ cat salaries
Yvette van der Hoff 100000
Sarack Abama 400000
Bernie Madoff...
by shantanuo (2009.05.04, 20:07)
skip networking in MySQL When
there is maintenance work to be carried on the database...
by shantanuo (2009.05.03, 21:04)
Saving data to text file
sqlite> .mode list
sqlite> .separator |
sqlite> .output test_file_1.txt
sqlite>...
by shantanuo (2009.05.02, 20:31)
Silent mode in Linux Sick
of your computer speaker beeping like a demented Morse code...
by shantanuo (2009.04.30, 12:51)
valid date validdate.sh script will
look like this...
#!/bin/sh
userdate=$1
date -d $userdate &> /dev/null...
by shantanuo (2009.04.13, 15:44)
IP addresses from access log
generate a list of IP address along with the number...
by shantanuo (2009.04.07, 12:04)
Backup a directory #!/bin/sh
tar czvf $1.$(date +%Y%m%d-%H%M%S).tgz $1
exit $?
The arc script accepts...
by shantanuo (2009.04.06, 15:47)
Time Zone error on slave
Last_Error: Error 'Unknown or incorrect time zone: 'Etc/UTC'' on query....
by shantanuo (2009.03.30, 13:05)
pager to md5sum When optimizing
queries by rewriting them to different forms that should return...
by shantanuo (2009.03.30, 13:03)
setting at jobs # at
-v 03:00 -f /root/shantanu/testat.sh > /root/shantanu/testat_result.txt 2>&1
# atq
7...
by shantanuo (2009.03.13, 10:07)
better code `test -s /var/log/mailme.txt`
if [[ $? -eq 0 ]] ; then
The above...
by shantanuo (2009.03.10, 18:15)
read .csv file #!/bin/sh
awk -F"," '{print $1,$2}' read1.txt | while read var1 var2
do...
by shantanuo (2009.03.10, 18:03)
common crontab entry 30 0
* * * updatedb > /dev/null 2>&1
# Clock synchronization...
by shantanuo (2009.03.10, 10:20)
Declare your assets! The declare
command can be helpful in identifying variables, environmental or otherwise....
by shantanuo (2009.03.01, 18:48)
Innodb troubleshooting When you have
your mysql up and running, just connect to any database...
by shantanuo (2009.02.26, 12:59)
Watch replication $ watch --interval=1
--differences 'mysql -uuser -ppassword -e "show slave status\G"'
by shantanuo (2009.02.25, 18:30)
findtable shell script # vi
/bin/findtable
#!bin/sh
mysql -e"select TABLE_SCHEMA, TABLE_NAME, ENGINE, TABLE_ROWS, CREATE_TIME FROM...
by shantanuo (2009.02.05, 17:31)
processor info Gather information about
the processor. This is easily done as follows:
# cat...
by shantanuo (2009.01.20, 19:44)
Help Me! You can use
the mysql client to perform lookups in the MySQL manual....
by shantanuo (2009.01.02, 20:33)
Show only PHP errors Open
/etc/php.ini file
# vi /etc/php.ini
Set error_reporting as follows:
error_reporting...
by shantanuo (2008.12.31, 16:46)
optimize all tables mysql -e"SELECT
CONCAT('OPTIMIZE TABLES ', GROUP_CONCAT(TABLE_SCHEMA, '.', TABLE_NAME ORDER BY TABLE_SCHEMA, TABLE_NAME...
by shantanuo (2008.11.11, 17:14)
Unix cheatsheets Cheat sheet act
as a reference tool which provides cut and paste kind...
by shantanuo (2008.11.08, 19:30)
|