<?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> &#187; MySQL</title>
	<atom:link href="http://toolboxdigital.com/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://toolboxdigital.com</link>
	<description></description>
	<lastBuildDate>Fri, 24 Feb 2012 15:53:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Advanced Techniques: Mass Settings Changes In Joomla!</title>
		<link>http://toolboxdigital.com/2010/01/advanced-techniques-mass-settings-changes-in-joomla/</link>
		<comments>http://toolboxdigital.com/2010/01/advanced-techniques-mass-settings-changes-in-joomla/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 10:21:08 +0000</pubDate>
		<dc:creator>Dan Luton</dc:creator>
				<category><![CDATA[Joomla]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://toolboxdigital.com/?p=461</guid>
		<description><![CDATA[This article describes how you can perform mass settings changes in Joomla using a simple MySQL query.]]></description>
			<content:encoded><![CDATA[<h4>Ever need to do a bulk settings change to an established site in Joomla? Perhaps you forgot to make the changes as you were building the site?</h4>
<p><span id="more-461"></span></p>
<p>We recently worked on a development which already had a complex hierarchy of menu links set-up on the system (approx. 200 links), but realised later in the development that the &quot;SSL Enabled&quot; flag in the menu settings needed to be set to the &quot;Off&quot; setting in order to force the majority of the site to run in non-SSL mode:</p>
<p><img alt="ssl-off" class="size-full" src="http://toolboxdigital.com/wp-content/uploads/2010/01/ssl-off.jpg" title="ssl-off" /></p>
<p>The obvious solution is to go through each menu item one at a time at set this manually &#8211; but there&#39;s a risk that some may be missed, and of course, the time it would take to do this to 200+ links would be considerable.</p>
<p>So, instead, we set about using simple find &amp; replace commands, we can run a query directly on the database to do this for us in one step. The query we will be using has this structure:</p>
<p><strong>NOTE: Please ensure you make a full backup of your database before proceeding &#8211; if there&#39;s a problem, you will easily be able to restore the database and try again.</strong></p>
<p>update <strong>TABLE_NAME</strong> set <strong>FIELD_NAME</strong> = replace(<strong>FIELD_NAME</strong>, &#39;string to find&#39;, &#39;new string&#39;)</p>
<p>Use a program such as <a href="http://http://www.phpmyadmin.net" target="_blank">PHPMyAdmin</a> to easily make edits to your database. Most hosting providers give easy access to this via your hosting control panel &#8211; this will allow you to find the table/field names and run the query easily.</p>
<p>So, in our case, it&#39;s fairly obvious we&#39;ll find the setting we need to adjust in the <strong>jos_menu</strong> table, so, browse the table, then click the edit icon to open up the contents of one of the rows:</p>
<p><img alt="phpmyadmin" class="size-full" src="http://toolboxdigital.com/wp-content/uploads/2010/01/phpmyadmin.jpg" title="phpmyadmin" /></p>
<p>You&#39;ll see I&#39;ve indicated the bit we need to change on the image above &#8211; it&#39;s in the field named <strong>params</strong>. So, we now know the name of the table, and the field that we need to modify. The text to search for (in this case) will be &quot;secure=0&quot; (so, any menu SSL settings that are set to &quot;ignore&quot;), and the setting we need to change to (like on the diagram) is &quot;secure=-1&quot; (&quot;Off). If you&#39;re in any doubt as to the setting that&#39;s needed, just change it in Joomla and view the string in PHPMyAdmin.</p>
<p>This now allows us to construct the final query that we will run on the database:</p>
<pre class="brush:sql">update jos_menu set params = replace(params, &#39;secure=0&#39;, &#39;secure=-1&#39;)
</pre>
<p>Simple, isn&#39;t it?</p>
<p>To run the query, simply click the &quot;SQL&quot; tab in PHPMyAdmin, paste your query into the box, and click go. Once it&#39;s run successfully, log into the Joomla administrator and check that everything was changed as expected.</p>
]]></content:encoded>
			<wfw:commentRss>http://toolboxdigital.com/2010/01/advanced-techniques-mass-settings-changes-in-joomla/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Scheduling a MySQL Database Backup on your VPS</title>
		<link>http://toolboxdigital.com/2009/09/scheduling-a-mysql-database-backup-on-your-vps/</link>
		<comments>http://toolboxdigital.com/2009/09/scheduling-a-mysql-database-backup-on-your-vps/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 09:16:22 +0000</pubDate>
		<dc:creator>Dan Luton</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[CRON]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[VPS]]></category>

		<guid isPermaLink="false">http://toolboxdigital.com/?p=45</guid>
		<description><![CDATA[How to create a scheduled script to backup your VPS site files and databases using CRON.]]></description>
			<content:encoded><![CDATA[<h4>The following guide will show you how to create and schedule a Bash server script in order to backup MySQL databases on your VPS or dedicated server.</h4>
<p>Please note that different server configurations may require slightly different commands to those shown, and please <strong>BACKUP EVERYTHING</strong> before proceeding. You use the following information at your own risk!</p>
<p><span id="more-45"></span></p>
<p>I recently purchased a decent VPS for hosting a handful of demanding Magento sites (my shared hosting is just not up to scratch unfortunately).</p>
<p>I like to be able to offer comprehensive backup solutions to clients for complete peace-of-mind &#8211; relying on your host to do this is a big no-no &#8211; they will only make sure their backups cover themselves in the event of a hardware failure, so will be of little use if you or your client makes a mistake and breaks the site, or if, God forbid, your site gets hacked or maliciously attacked.</p>
<p>Joomla has a few options for auto-backing up your database and sending an email &#8211; so I started hunting around for Bash Scripts that I could run via CRON to do this for multiple databases on my VPS.</p>
<p>After visiting a few dozen pages, I finally managed to put everything together in my own Bash script and deployed it to the VPS, scheduled to run every day &#8211; and it works perfectly! So, without further ado, here&#39;s the process and script you need to implement this on your own server.</p>
<p>My VPS runs the Plesk control panel, so the process may be slightly different for your server, but the method should be the same. You will need root access via SSH in order to test the script.</p>
<h3>STEP ONE: Setup your Server Folders</h3>
<p>I set my folders up on the server root. You will need two folders:</p>
<ul class="bullet">
<li><strong>scripts</strong></li>
<li><strong>mysqlbackups</strong></li>
</ul>
<p>The names are just suggestions; you can use whatever you want for these.</p>
<p>You can create these folders via FTP (use the root account for the server) or via the control panel file manager.</p>
<h3>STEP TWO: Create your Script</h3>
<p>Using a plain text editor (I used Coda for this), create the following script:</p>
<pre class="brush:text">#!/bin/sh
mysqldump -udatabase_user_name -pdatabase_password --opt database_name &gt;
/mysqlbackups/mysql_backup.sql
cd /mysqlbackups/
tar -zcvf mysql_backup.tgz mysql_backup.sql
uuencode mysql_backup.tgz mysql_backup.tgz &gt; mysql_backup.uuc
mail -s &quot;MySQL Backup&quot; myemail@domain.com &lt; mysql_backup.uuc
rm -f mysql_backup.uuc
rm -f mysql_backup.tgz
rm -f mysql_backup.sql
</pre>
<p>&#8230;and save it as mysqlbackup.sh.</p>
<p><strong>NOTE: The following code should be all on one line, without the line-break:</strong></p>
<pre class="brush:text">mysqldump -udatabase_user_name -pdatabase_password --opt database_name &gt;
/mysqlbackups/mysql_backup.sql
</pre>
<p>You can easily add more MySQL databases to the backup list by duplicating the above and changing the filenames (so that you can tell them apart, of course!).</p>
<h3>STEP THREE: Upload and Test</h3>
<p>You should now upload the saved script to your server. Upload it to the &quot;scripts&quot; directory you created in Step One.</p>
<p>To test, logon to the server via an SSH terminal, and go to the scripts directory:</p>
<pre class="brush:text">cd /scripts
</pre>
<p>Now run the script &#8211; this command may vary, so if it does not work for you, you may have to investigate the correct command for your server environment.</p>
<pre class="brush:text">bash -x mysqlbackup.sh
</pre>
<p>The terminal window should output the results (no errors with any luck), and if you check your email inbox you should have been emailed the .tgz backup file!</p>
<p>The original files created (the .sql, .tgz and .uuc files) are all deleted from the server via the script after it has run successfully.</p>
<h3>STEP FOUR: Schedule Via CRON</h3>
<p>Now that you&#39;ve confirmed the script works correctly, you can schedule it to run whenever you like. I set mine to run every day at 1pm:</p>
<p><img alt="cron" class="alignnone size-full wp-image-389" height="394" src="http://toolboxdigital.com/wp-content/uploads/2009/09/cron.jpg" title="cron" width="630" /></p>
<p>And that&#39;s all there is to it &#8211; you now have an auto-backup schedule for your MySQL database!</p>
<p><small>(Thanks to <a href="http://paulbradley.tv/38/" target="_blank">Paul Bradley</a> for the original starting point for the Bash script)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://toolboxdigital.com/2009/09/scheduling-a-mysql-database-backup-on-your-vps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

