<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pario TechnoBlob &#187; Database</title>
	<atom:link href="http://pario.no/tag/database/feed/" rel="self" type="application/rss+xml" />
	<link>http://pario.no</link>
	<description>A cronological documentation test project, nothing serious, really!</description>
	<lastBuildDate>Thu, 02 Feb 2012 13:17:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Create a mysql trigger</title>
		<link>http://pario.no/2008/10/01/create-a-mysql-trigger/</link>
		<comments>http://pario.no/2008/10/01/create-a-mysql-trigger/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 15:05:24 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[triggers]]></category>

		<guid isPermaLink="false">http://pario.no/?p=683</guid>
		<description><![CDATA[This is a short description on how you can create an easy Trigger in mysql. My trigger will insert todays date when I insert a new database record. A trigger is a named database object that is associated with a table, and that activates when a particular event occurs for the table. Some uses for [...]]]></description>
			<content:encoded><![CDATA[<p>This is a short description on how you can create an easy Trigger in mysql. My trigger will insert todays date when I insert a new database record.</p>
<blockquote><p>A trigger is a named database object that is associated with a table, and that activates when a particular event occurs for the table. Some uses for triggers are to perform checks of values to be inserted into a table or to perform calculations on values involved in an update. </p></blockquote>
<p>First you have to create a table to work with</p>
<pre>
CREATE TABLE IF NOT EXISTS `Links` (
  `Id` int(11) NOT NULL auto_increment,
  `DateInserted` date NOT NULL,
  PRIMARY KEY  (`Id`)
)</pre>
<p>Then we create the trigger that will insert todays date, curdate(), when you insert a new row</p>
<pre>
CREATE TRIGGER Links_TriggerDate BEFORE INSERT ON Links
FOR EACH
ROW
SET NEW.DateInserted = curdate( ) </pre>
<p>Triggers is a functionality that was introduced in mysql version 5.0.2<br />
To view all your triggers i mysql</p>
<pre>
mysql> show triggers;
+--------------------+--------+--------+----------------------------------+--------+---------+----------+----------------+
| Trigger            | Event  | Table  | Statement                        | Timing | Created | sql_mode | Definer        |
+--------------------+--------+--------+----------------------------------+--------+---------+----------+----------------+
| Links_TriggerDate | INSERT | Links | SET NEW.DateInserted = curdate( ) | BEFORE | NULL    |          | root@localhost |
+--------------------+--------+--------+----------------------------------+--------+---------+----------+----------------+
1 row in set (0.00 sec)
</pre>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDgvMTAvMDEvY3JlYXRlLWEtbXlzcWwtdHJpZ2dlci88d3B0Yj5DcmVhdGUgYSBteXNxbCB0cmlnZ2VyPHdwdGI%2BaHR0cDovL3BhcmlvLm5vPHdwdGI%2BUGFyaW8gVGVjaG5vQmxvYg%3D%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2008/10/01/create-a-mysql-trigger/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable query caching in mysql</title>
		<link>http://pario.no/2008/09/13/enable-query-caching-in-mysql/</link>
		<comments>http://pario.no/2008/09/13/enable-query-caching-in-mysql/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 11:15:36 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Photo etc]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://pario.no/?p=624</guid>
		<description><![CDATA[Query caching is a way to increase the performance of mysql by caching database queries. It&#8217;s quite easy to do and only requires to edit one file, in Debian it&#8217;s called /etc/mysql/my.cnf Add the following lines in the mysqld section [mysqld] query-cache-type = 1 query-cache-size = 10M restart the mysql daemon # /etc/init.d/mysql restart Verify [...]]]></description>
			<content:encoded><![CDATA[<p>Query caching is a way to increase the performance of mysql by caching database queries.<br />
It&#8217;s quite easy to do and only requires to edit one file, in Debian it&#8217;s called <b>/etc/mysql/my.cnf</b></p>
<p>Add the following lines in the mysqld section</p>
<pre>
[mysqld]
query-cache-type = 1
query-cache-size = 10M</pre>
<p>restart the mysql daemon</p>
<pre>
# /etc/init.d/mysql restart</pre>
<h2>Verify that query caching is enabled</h2>
<pre>
# mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 33499
Server version: 5.0.32-Debian_7etch6-log Debian etch distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

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             | 10485760 |
| query_cache_type             | ON       |
| query_cache_wlock_invalidate | OFF      |
+------------------------------+----------+
6 rows in set (0.00 sec)
</pre>
<p>If you see something like the out above, caching is enabled.</p>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDgvMDkvMTMvZW5hYmxlLXF1ZXJ5LWNhY2hpbmctaW4tbXlzcWwvPHdwdGI%2BRW5hYmxlIHF1ZXJ5IGNhY2hpbmcgaW4gbXlzcWw8d3B0Yj5odHRwOi8vcGFyaW8ubm88d3B0Yj5QYXJpbyBUZWNobm9CbG9i";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2008/09/13/enable-query-caching-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql_secure_installation — Improve MySQL Installation Security</title>
		<link>http://pario.no/2008/02/19/mysql_secure_installation-%e2%80%94-improve-mysql-installation-security/</link>
		<comments>http://pario.no/2008/02/19/mysql_secure_installation-%e2%80%94-improve-mysql-installation-security/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 23:37:36 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://pario.no/2008/02/19/mysql_secure_installation-%e2%80%94-improve-mysql-installation-security/</guid>
		<description><![CDATA[This program enables you to improve the security of your MySQL installation in the following ways: You can set a password for root accounts. You can remove root accounts that are accessible from outside the local host. You can remove anonymous-user accounts. You can remove the test database, which by default can be accessed by [...]]]></description>
			<content:encoded><![CDATA[<p> This program enables you to improve the security of your MySQL installation in the following ways:</p>
<ul>
<li>You can set a password for root accounts.</li>
<li>You can remove root accounts that are accessible from outside the local host.</li>
<li>You can remove anonymous-user accounts.</li>
<li>You can remove the test database, which by default can be accessed by anonymous users.</li>
</ul>
<p>Invoke <strong>mysql_secure_installation</strong> without arguments:</p>
<pre>
shell&gt; mysql_secure_installation</pre>
<p>The script will prompt you to determine which actions to perform.</p>
<p>Source: <a href="http://dev.mysql.com/doc/refman/5.0/en/mysql-secure-installation.html">http://dev.mysql.com</a></p>
<script type="text/javascript">var wordpress_toolbar_urls = ["http:\/\/dev.mysql.com\/doc\/refman\/5.0\/en\/mysql-secure-installation.html"];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDgvMDIvMTkvbXlzcWxfc2VjdXJlX2luc3RhbGxhdGlvbi0lZTIlODAlOTQtaW1wcm92ZS1teXNxbC1pbnN0YWxsYXRpb24tc2VjdXJpdHkvPHdwdGI%2BbXlzcWxfc2VjdXJlX2luc3RhbGxhdGlvbiDigJQgSW1wcm92ZSBNeVNRTCBJbnN0YWxsYXRpb24gU2VjdXJpdHk8d3B0Yj5odHRwOi8vcGFyaW8ubm88d3B0Yj5QYXJpbyBUZWNobm9CbG9i";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2008/02/19/mysql_secure_installation-%e2%80%94-improve-mysql-installation-security/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql create utf8 database</title>
		<link>http://pario.no/2008/01/27/mysql-create-utf8-database/</link>
		<comments>http://pario.no/2008/01/27/mysql-create-utf8-database/#comments</comments>
		<pubDate>Sat, 26 Jan 2008 22:28:42 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://pario.no/2008/01/27/mysql-create-utf8-database/</guid>
		<description><![CDATA[This is the way to create a mysql database with UTF8 characterset CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;]]></description>
			<content:encoded><![CDATA[<p>This is the way to create a mysql database with UTF8 characterset</p>
<pre>
CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;</pre>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDgvMDEvMjcvbXlzcWwtY3JlYXRlLXV0ZjgtZGF0YWJhc2UvPHdwdGI%2BbXlzcWwgY3JlYXRlIHV0ZjggZGF0YWJhc2U8d3B0Yj5odHRwOi8vcGFyaW8ubm88d3B0Yj5QYXJpbyBUZWNobm9CbG9i";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2008/01/27/mysql-create-utf8-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backup mysql databases into separate files</title>
		<link>http://pario.no/2007/11/18/backup-mysql-databases-into-separate-files/</link>
		<comments>http://pario.no/2007/11/18/backup-mysql-databases-into-separate-files/#comments</comments>
		<pubDate>Sun, 18 Nov 2007 21:07:39 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[mysqldump]]></category>

		<guid isPermaLink="false">http://pario.no/2007/11/18/backup-mysql-databases-into-separate-files/</guid>
		<description><![CDATA[This bach script makes separate backup files of all the databases in mysql and saves the result in the mysql_backup folder. #!/bin/bash -v USERNAME='yourusername' PASSWORD='yourpassword' HOSTNAME='yourhostname' BackupFolder='/backup' for i in $(echo 'SHOW DATABASES;' &#124; mysql --user $USERNAME -p$PASSWORD -h $HOSTNAME &#124; grep -v '^Database$' ); do mysqldump --user $USERNAME -p$PASSWORD -h $HOSTNAME --opt $i > [...]]]></description>
			<content:encoded><![CDATA[<p>This bach script makes separate backup files of all the databases in mysql and saves the result in the mysql_backup folder.</p>
<pre>#!/bin/bash -v

USERNAME='yourusername'
PASSWORD='yourpassword'
HOSTNAME='yourhostname'
BackupFolder='/backup'

for i in $(echo 'SHOW DATABASES;' | mysql --user $USERNAME -p$PASSWORD -h $HOSTNAME | grep -v '^Database$' ); do
        mysqldump --user $USERNAME -p$PASSWORD -h $HOSTNAME --opt $i > $BackupFolder/$i.sql;
done;</pre>
<p>Remember to change the -h, -p and -h switch according to your needs and avoid space between -p and the password variable.</p>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMTEvMTgvYmFja3VwLW15c3FsLWRhdGFiYXNlcy1pbnRvLXNlcGFyYXRlLWZpbGVzLzx3cHRiPkJhY2t1cCBteXNxbCBkYXRhYmFzZXMgaW50byBzZXBhcmF0ZSBmaWxlczx3cHRiPmh0dHA6Ly9wYXJpby5ubzx3cHRiPlBhcmlvIFRlY2hub0Jsb2I%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/11/18/backup-mysql-databases-into-separate-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

