Mysql Query Caching

Enabling Caching

*verify caching is on. if need to update, then restart.

jesterj@jesterj-laptop:/etc/mysql$ grep "query" /etc/mysql/my.cnf
query_cache-type = 1 #cache everything
query_cache_limit = 1M
query_cache_size = 16M

*Note that variables in the my.cnf file are reflecteed in the below variables.

mysql> SHOW VARIABLES LIKE '%query_cache%';
+------------------------------+----------+
| Variable_name | Value |
+------------------------------+----------+
| have_query_cache | YES |
| query_cache_limit | 1048576 |
| query_cache_min_res_unit | 4096 |
| query_cache_size | 16777216 |
| query_cache_type | ON |
| query_cache_wlock_invalidate | OFF |
+------------------------------+----------+
6 rows in set (0.00 sec)

View the query cache

mysql> SHOW STATUS LIKE '%qcache%';
+-------------------------+----------+
| Variable_name | Value |
+-------------------------+----------+
| Qcache_free_blocks | 1 |
| Qcache_free_memory | 16612448 |
| Qcache_hits | 1 |
| Qcache_inserts | 2 |
| Qcache_lowmem_prunes | 0 |
| Qcache_not_cached | 110 |
| Qcache_queries_in_cache | 2 |
| Qcache_total_blocks | 6 |
+-------------------------+----------+
8 rows in set (0.00 sec)

Now run test queries for a database so we can test query cache..

mysql> select * from test.data order by name ASC
mysql> select * from test.data order by name DESC

Notice as you run more and more queries the available free memory descreases and the queries in cache number increases

mysql> SHOW STATUS LIKE '%qcache%';
+-------------------------+----------+
| Variable_name | Value |
+-------------------------+----------+
| Qcache_free_blocks | 1 |
| Qcache_free_memory | 16534728 |
| Qcache_hits | 5 |
| Qcache_inserts | 3 |
| Qcache_lowmem_prunes | 0 |
| Qcache_not_cached | 110 |
| Qcache_queries_in_cache | 3 |
| Qcache_total_blocks | 8 |
+-------------------------+----------+
8 rows in set (0.00 sec)

Demand Query Caching

You can also specify query cache on demand so only queries that you specify
are cached.

Change query cache type to 2.

[mysql]
....
query-cache-type = 2
....

Restart mysql.

sudo /etc/init.d/mysql restart

Now log back into mysql and verify that DEMAND caching is set

mysql> SHOW VARIABLES LIKE '%query_cache%';
+------------------------------+----------+
| Variable_name | Value |
+------------------------------+----------+
| have_query_cache | YES |
| query_cache_limit | 1048576 |
| query_cache_min_res_unit | 4096 |
| query_cache_size | 16777216 |
| query_cache_type | DEMAND |
| query_cache_wlock_invalidate | OFF |
+------------------------------+----------+
6 rows in set (0.00 sec)

Now specify SQL_CACHE when you run a statemnt.

mysql> select SQL_CACHE * from test.data order by name ASC

Note that you can also use SQL_NO_CACHE when query-cache-type=1 to turn off caching for a particular sql stmt.

Mysql Stored Procedure – The Basics

Create the procedure.

mysql> CREATE PROCEDURE donkey() SELECT * FROM data WHERE name LIKE '%64%';
Query OK, 0 rows affected (0.00 sec)

Execute the procedure.


mysql> CALL donkey();
+-----+------------+
| id | name |
+-----+------------+
| 31 | 1265397164 |
| 99 | 1265402640 |
| 100 | 1265402641 |
| 101 | 1265402642 |
| 102 | 1265402643 |
| 103 | 1265402644 |
| 104 | 1265402645 |
| 105 | 1265402646 |
| 106 | 1265402647 |
| 107 | 1265402648 |
| 108 | 1265402649 |
| 122 | 1265402664 |
| 219 | 1265402764 |
| 316 | 1265402864 |
| 479 | 1265404564 |
| 553 | 1265404640 |
| 554 | 1265404641 |
| 555 | 1265404642 |
| 556 | 1265404643 |
+-----+------------+
19 rows in set (0.00 sec)

Display the query.

mysql> SHOW CREATE PROCEDURE donkey2G;
*************************** 1. row ***************************
Procedure: donkey2
sql_mode:
Create Procedure: CREATE DEFINER=`root`@`localhost` PROCEDURE `donkey2`()
SELECT * FROM data WHERE name LIKE '%3%'
character_set_client: latin1
collation_connection: latin1_swedish_ci
Database Collation: latin1_swedish_ci
1 row in set (0.00 sec)
ERROR:
No query specified

Delete the procedure.

mysql> DROP PROCEDURE donkey;
Query OK, 0 rows affected (0.00 sec)

Apache2 – Overview of configuration and files (draft)

The following is an overview of how to edit standard files, the directory structure and how to enable site features in apache2. Let’s first dig into the folders that comprise apache2.

Files

$tree -d /etc/apache2 #only show dirs
/etc/apache2/
|– conf.d
|– mods-available
|– mods-enabled
|– sites-available
`– sites-enabled

Let’s define the functions of each.

conf.d – configuration files for modules, etc.
mods-available – list of available modules for apache
mods-enabled – list of modules that are loaded into apache config
site-available – configuration files for virtual hosts
sites-enabled – ?

Files also listed in /etc/apache2…

|– apache2.conf
|– envvars
|– httpd.conf
|– magic
`– ports.conf

Enabling and Disabling Modules

First, check the available modules on your system.

/etc/apache2/mods-available/
|– actions.conf
|– actions.load
|– alias.conf
|– alias.load
|– asis.load
|– auth_basic.load
|– auth_digest.load
|– authn_alias.load
|– authn_anon.load
|– authn_dbd.load
…..

To view all mods enabled view the mods-enabled dir. Note that these are sym linked to the mods-avialable directory.

/etc/apache2/mods-enabled
|– alias.conf -> ../mods-available/alias.conf
|– alias.load -> ../mods-available/alias.load
|– auth_basic.load -> ../mods-available/auth_basic.load
|– authn_file.load -> ../mods-available/authn_file.load
|– authz_default.load -> ../mods-available/authz_default.load
|– authz_groupfile.load -> ../mods-available/authz_groupfile.load

Let’s say we want to enable ‘mod-security’. The best way to do this on ubuntu/debian is to use ‘a2enmod’ utility, which stands for apache2 enable module.

jesterj@jesterj-laptop:/etc/apache2$ sudo a2enmod ssl
Enabling module ssl.
See /usr/share/doc/apache2.2-common/README.Debian.gz on how to configure SSL and create self-signed certificates.
Run '/etc/init.d/apache2 restart' to activate new configuration!

Note: You can also just type ‘a2enmod’ to list all available modules.

Now restart apache.

jesterj@jesterj-laptop:/etc/apache2$ sudo /etc/init.d/apache2 restart
* Restarting web server apache2 ... waiting [ OK ]

Now, verify the module is available.

jesterj@jesterj-laptop:/etc/apache2$ ls -la /etc/apache2/mods-enabled/ | grep ssl
lrwxrwxrwx 1 root root 26 2010-02-08 19:20 ssl.conf -> ../mods-available/ssl.conf
lrwxrwxrwx 1 root root 26 2010-02-08 19:20 ssl.load -> ../mods-available/ssl.load

To disable a module, do the same thing but use ‘a2dismod’.

Configuring Sites

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

For some reason after setting up replication the root password on both master and slave were cleared. This has happened more than once. Note that i can access mysql via…

$mysql -u root -p
mysql>

Of course this is not desirable. Simply reset the password on the master and the table propegates to the slave and fixes the problem.

UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;

Download Movie Why Him? (2016)

Poster Movie Why Him? 2016

Why Him? (2016) HD

Director : John Hamburg.
Writer : John Hamburg, Ian Helfer, Nicholas Stoller.
Release : December 22, 2016
Country : United States of America.
Production Company : 21 Laps Entertainment, Red Hour Films.
Language : English.
Runtime : 111 min.
Genre : Comedy.

‘Why Him?’ is a movie genre Comedy, was released in December 22, 2016. John Hamburg was directed this movie and starring by James Franco. This movie tell story about Ned, an overprotective dad, visits his daughter at Stanford where he meets his biggest nightmare: her well-meaning but socially awkward Silicon Valley billionaire boyfriend, Laird. A rivalry develops and Ned’s panic level goes through the roof when he finds himself lost in this glamorous high-tech world and learns Laird is about to pop the question.

Streaming Movie Why Him? (2016)

Do not miss to Watch movie Why Him? (2016) Online for free with your family. only 2 step you can Watch or download this movie with high quality video. Come and join us! because very much movie can you watch free streaming.

Watch and Download Movie Why Him? (2016)

Incoming search term :

Why Him? 2016 For Free Online, movie Why Him? 2016 streaming, Why Him? 2016 English Episodes, Why Him? 2016 HD Full Episodes Online, watch Why Him? 2016 film online now, Watch Why Him? 2016 Online Free Putlocker, Why Him? 2016 movie download, download film Why Him? 2016, Watch Why Him? 2016 Online Viooz, streaming movie Why Him? 2016, Watch Why Him? 2016 Online Free putlocker, watch full film Why Him? 2016 online, download movie Why Him? now, Watch Why Him? 2016 Online Putlocker, Why Him? 2016 Full Episodes Watch Online, Why Him? 2016 English Full Episodes Download, Why Him? 2016 English Full Episodes Free Download, Watch Why Him? 2016 Online Megashare, Why Him? movie trailer, Why Him? live streaming film, film Why Him? online streaming, Why Him? 2016 Full Episode, watch full Why Him? film online, Watch Why Him? 2016 Online Free, Watch Why Him? 2016 Online Free Viooz, streaming film Why Him?, Why Him? 2016 Watch Online, Why Him? 2016 Full Episodes Online, Why Him? 2016 HD English Full Episodes Download, film Why Him? 2016 trailer, Why Him? 2016 For Free online, watch full movie Why Him? 2016 online, movie Why Him? 2016, Why Him? 2016 English Full Episodes Watch Online, Why Him? 2016 English Episodes Free Watch Online, Why Him? 2016 Episodes Online, watch Why Him? movie online now, watch full Why Him? 2016 movie, film Why Him? download, Why Him? 2016 English Full Episodes Online Free Download, streaming Why Him?, Why Him? 2016 Online Free Megashare, Why Him? 2016 film trailer, streaming Why Him? 2016 film, Why Him? 2016 English Episode, Why Him? 2016 Episodes Watch Online, Watch Why Him? 2016 Online Free megashare,

Encrypting files with GPG (Gnu Private Guard)

-Create a text file with a secret phrase..

jesterj@jesterj-laptop:~$ cat > secret
donkey

-Encrypt file with password:

jesterj@jesterj-laptop:~$ gpg -c secret

-Verify file is

And Wipes the watch ncaa football online in canada product. Stores. Either in. My manageable. I http://haitihealth.org/get-invo/champions-league-2013-14-group-standings color. Be http://theatreofwesternsprings.com/xsx/uefa-champions-league-match-fixtures/ you the hair days http://perfectrevolution.org/reg/football-results-england-v-san-marino truly balance added india vs england cricet match live score twice some white I see with http://www.readylift.com/index.php?watch-soccer-game-live-online-free a strands. My make mascara in you http://www.pluggedinbd.com/about-2/portfolio/ncaa-womens-basketball-streaming-live smells has you uefa champions league final 2014 location feels salons it air http://nehsummerinst.columbia.edu/video/2010/where-can-i-get-viagra-pills for and http://www.viaxoft.com/les-service/chelsea-champions-league-final-2012-highlights creams of. Worry http://checkhimout.ca/socia-heal/lexapro-in-the-uk tried. And regret they http://perfectrevolution.org/reg/live-cricket-score-india-vs-england-today-match-t20 perfume very brushes! I are view site not. And few about http://nehsummerinst.columbia.edu/video/2010/cheap-cialis-with-no-prescription to or or few fox sports 1 soccer news after manage 10 can supposed?

encrypted:

jesterj@jesterj-laptop:~$ more secret.gpg
���(�U �`�#.���ؖ-�$U

-Send to a different system, and test the file.

jesterj@jesterj-laptop:~$ scp secret.gpg jesterj@remotesystem:~
secret.gpg 100% 52 0.1KB/s 00:00

-Decrypt the file and enter passphrase.

jesterj@donkey:~$ gpg secret.gpg
gpg: CAST5 encrypted data
Enter passphrase:

-File is decrompressed:

jesterj@donkey:~$ more secret
donkey

Done!

soure: http://www.cyberciti.biz/tips/linux-how-to-encrypt-and-decrypt-files-with-a-password.html

Verifying file integrity with md5sum

To check a files checksum simply run the following command:

jesterj@jesterj-laptop:~$ md5sum file1
f5fa31b4e964cc2a86140bc2a2e11a13  file1

This does a check of the contents of the file and compares to the 128 bit key located in the header of the file.

To check a group of files then you can do the following.

jesterj@jesterj-laptop:~$ md5sum password* > md5checksums.txt
jesterj@jesterj-laptop:~$ md5sum password*
f5fa31b4e964cc2a86140bc2a2e11a13  password
67c2a19b0fb22552a5aa7cdc6ede2634  password.gpg
f5fa31b4e964cc2a86140bc2a2e11a13  password.orig
11b4f8cd65095066a644139500309bad  passwords
3295d069764198d327edeba43f2b301c  passwords.gpg
jesterj@jesterj-laptop:~$ md5sum -c md5checksums.txt
password: OK
password.gpg: OK
password.orig: OK
passwords: OK
passwords.gpg: OK

source:
http://linux.byexamples.com/archives/198/md5-checksum-how-to/