<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>Usefuljaja - Home</title>
  <id>tag:www.usefuljaja.com,2007:mephisto/</id>
  <generator uri="http://mephistoblog.com" version="0.7.3">Mephisto Noh-Varr</generator>
  <link href="http://www.usefuljaja.com/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://www.usefuljaja.com/" rel="alternate" type="text/html"/>
  <updated>2007-10-12T12:52:39Z</updated>
  <entry xml:base="http://www.usefuljaja.com/">
    <author>
      <name>PickledOnion</name>
    </author>
    <id>tag:www.usefuljaja.com,2007-08-31:275</id>
    <published>2007-08-31T19:02:00Z</published>
    <updated>2007-10-12T12:52:39Z</updated>
    <category term="Bash basics"/>
    <category term="Debian VPS"/>
    <category term="Litespeed"/>
    <category term="Mephisto"/>
    <category term="MySQL"/>
    <category term="Slicehost VPS"/>
    <category term="Subversion"/>
    <category term="Ubuntu VPS"/>
    <category term="VPS Admin"/>
    <category term="VPS Basics"/>
    <link href="http://www.usefuljaja.com/2007/8/the-future-aka-what-now" rel="alternate" type="text/html"/>
    <title>The future - a.k.a. What now?</title>
<summary type="html">&lt;p&gt;As you may know I have officially joined the ranks of &lt;a href=&quot;http://blog.slicehost.com/articles/2007/08/31/pickledonion-joins-slicehost&quot; title=&quot;Slicehost Blog article&quot;&gt;Slicehost&lt;/a&gt; as a support/article/helper type bloke (with a dreamy accent to boot!).&lt;/p&gt;

&lt;p&gt;So what does that mean for usefuljaja.com?&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;As you may know I have officially joined the ranks of &lt;a href=&quot;http://blog.slicehost.com/articles/2007/08/31/pickledonion-joins-slicehost&quot; title=&quot;Slicehost Blog article&quot;&gt;Slicehost&lt;/a&gt; as a support/article/helper type bloke (with a dreamy accent to boot!).&lt;/p&gt;

&lt;p&gt;So what does that mean for usefuljaja.com?&lt;/p&gt;
&lt;p&gt;Well, first of all I'd like to thank everyone for their support during the past few weeks and months. The emails and general encouragement have been great to hear and the advice and suggestions have helped me enormously.&lt;/p&gt;

&lt;p&gt;The existing articles are &lt;strong&gt;not&lt;/strong&gt; going anywhere. The site will remain up and freely available to all who want to use them.&lt;/p&gt;

&lt;p&gt;One of my main roles at Slicehost will be to create a repository of articles and tutorials (much as I have done here, but specifically aimed at Slicehost users).&lt;/p&gt;

&lt;p&gt;As such, I can point you to that url: &lt;a href=&quot;http://articles.slicehost.com&quot; title=&quot;Slicehost Articles&quot;&gt;articles.slicehost.com&lt;/a&gt; and say that if an article is not already here then it will, eventually, be there.&lt;/p&gt;

&lt;p&gt;So a plain answer as to the questions of a continued expansion of usefuljaja is that I just don't know but I imagine it sitting quietly and helping those of you who want it.&lt;/p&gt;

&lt;p&gt;I am very excited about the opportunity at Slicehost so I will be spending a great deal of time there and, as I say, one of my roles will be to continue with much the same type of thing I have done here.&lt;/p&gt;

&lt;p&gt;So rather than a goodbye, it's more of a 'see you there'.&lt;/p&gt;

&lt;p&gt;Many thanks.&lt;/p&gt;

&lt;p&gt;PickledOnion.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.usefuljaja.com/">
    <author>
      <name>PickledOnion</name>
    </author>
    <id>tag:www.usefuljaja.com,2007-08-17:259</id>
    <published>2007-08-17T12:42:00Z</published>
    <updated>2007-08-17T13:06:34Z</updated>
    <category term="MySQL"/>
    <category term="mysql"/>
    <link href="http://www.usefuljaja.com/2007/8/mysql-searching-for-a-record" rel="alternate" type="text/html"/>
    <title>MySQL - searching for a record</title>
<summary type="html">&lt;p&gt;When the database has more than a handful of records, we need a way of searching for a particular record. The point of a database is to hold the information for us so we don't have to remember it all.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;When the database has more than a handful of records, we need a way of searching for a particular record. The point of a database is to hold the information for us so we don't have to remember it all.&lt;/p&gt;
&lt;p&gt;To make this article more practical we need some more entries in our 'pickled1' colleagues table. To save you some writing you can import this &lt;a href=&quot;http://www.usefuljaja.com/assets/2007/8/17/pickled1.sql&quot; title=&quot;Example sql file&quot;&gt;pickled1.sql&lt;/a&gt; file. &lt;/p&gt;

&lt;p&gt;The sql file contain 15 basic records. To import the data:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mysql -u root -p pickled1 &amp;lt; pickled1.sql&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Search&lt;/h3&gt;

&lt;p&gt;Now we have some more data, log into MySQL pickled1 database:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mysql -u root -p pickled1&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If we display the contents we can see that with only 15 entries, it's getting difficult to navigate and get the information we want:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;select * from colleagues;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So let's do a search for a name that contains 'dave':&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;select * from colleagues where name like '%dave%';&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That will return the 4 entries that have 'dave' in the name column.&lt;/p&gt;

&lt;p&gt;Still too many, I want to know how many people named Dave also have Dave in their email address:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;select * from colleagues where name like '%dave%' and email like '%dave%';&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That returned 3 records. Who's the other one? Let's have a look:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;select * from colleagues where name like '%dave%' and email not like '%dave%';&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Ah, the record returned good old marshy:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;7 | Dave Marshal | marshy@domain.tld&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Order&lt;/h3&gt;

&lt;p&gt;That's OK but we prefer a bit of 'order' to our lists. Lets display the list of Daves in alphabetical order:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;select * from colleagues where name like '%dave%' order by name;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That's better.&lt;/p&gt;

&lt;h3&gt;Counting&lt;/h3&gt;

&lt;p&gt;Sometimes all you need is to count the records available.&lt;/p&gt;

&lt;p&gt;Let's see how many records we have in the colleagues table:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;select count(*) from colleagues;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Well, now we know there are 15 entries.&lt;/p&gt;

&lt;p&gt;What about how many Daves I know?&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;select count(*) from colleagues where name like '%dave%';&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Hmm, that's 4 Daves. I wonder if that's too many? Maybe I need to know more Sallys.&lt;/p&gt;

&lt;p&gt;Anyway, you can get as detailed as you like with the select and count queries but I hope this clears any doubts as to how simple manipulating the data actually is.&lt;/p&gt;

&lt;p&gt;PickledOnion.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.usefuljaja.com/">
    <author>
      <name>PickledOnion</name>
    </author>
    <id>tag:www.usefuljaja.com,2007-08-17:258</id>
    <published>2007-08-17T11:39:00Z</published>
    <updated>2007-08-17T11:40:49Z</updated>
    <category term="MySQL"/>
    <category term="mysql"/>
    <link href="http://www.usefuljaja.com/2007/8/mysql-exporting-and-importing-records" rel="alternate" type="text/html"/>
    <title>MySQL - exporting and importing records</title>
<summary type="html">&lt;p&gt;Whether it is for a quick database backup or to import existing records to a new database for a server move, importing and exporting records is a basic and essential function.&lt;/p&gt;

&lt;p&gt;Luckily, saving the data and moving it to a new MySQL database could not be easier.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;Whether it is for a quick database backup or to import existing records to a new database for a server move, importing and exporting records is a basic and essential function.&lt;/p&gt;

&lt;p&gt;Luckily, saving the data and moving it to a new MySQL database could not be easier.&lt;/p&gt;
&lt;p&gt;Firstly, log into your VPS. The commands shown below are made from the BASH command prompt - in other words, you do not need to log into MySQL.&lt;/p&gt;

&lt;h3&gt;Export&lt;/h3&gt;

&lt;p&gt;So, to export a particular database issue one simple command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mysqldump -u root -p pickled1 &amp;gt; pickled1.sql&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It's as simple as that. In this example, I used the MySQL root user and 'pickled1' refers to the database we have been using during these articles.&lt;/p&gt;

&lt;p&gt;Once done, we have a file named 'pickled1.sql' which can be copied to the new server ready for importing to the new MySQL install.&lt;/p&gt;

&lt;h3&gt;Import&lt;/h3&gt;

&lt;p&gt;Importing the data is just as simple.&lt;/p&gt;

&lt;p&gt;Create the new database (it does not have to be named the same as the old database):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mysqladmin -u root -p create pickled1_new&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now import the data from the old database to the newly created one:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mysql -u root -p pickled1_new &amp;lt; pickled1.sql&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Again, that's it. Very simple indeed.&lt;/p&gt;

&lt;p&gt;Now the newly created 'pickled1_new' database has been populated with the data exported from the original 'pickled1' database.&lt;/p&gt;

&lt;p&gt;PickledOnion&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.usefuljaja.com/">
    <author>
      <name>PickledOnion</name>
    </author>
    <id>tag:www.usefuljaja.com,2007-08-14:255</id>
    <published>2007-08-14T14:22:00Z</published>
    <updated>2007-08-14T14:23:49Z</updated>
    <category term="Ubuntu VPS"/>
    <category term="ubuntu"/>
    <category term="upgrade"/>
    <link href="http://www.usefuljaja.com/2007/8/upgrading-to-feisty" rel="alternate" type="text/html"/>
    <title>Upgrading to Feisty</title>
<summary type="html">&lt;p&gt;OK, so you've read &lt;a href=&quot;http://www.usefuljaja.com/2007/7/why-you-shouldnt-upgrade-to-feisty&quot; title=&quot;Why you shouldn't upgrade to Ubuntu Feisty&quot;&gt;Why you shouldn't upgrade to Ubuntu Feisty&lt;/a&gt; and decided you still want to use Ubuntu Feisty.&lt;/p&gt;

&lt;p&gt;No problem, let's go ahead and upgrade from Ubuntu LTS to Ubuntu Feisty.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;OK, so you've read &lt;a href=&quot;http://www.usefuljaja.com/2007/7/why-you-shouldnt-upgrade-to-feisty&quot; title=&quot;Why you shouldn't upgrade to Ubuntu Feisty&quot;&gt;Why you shouldn't upgrade to Ubuntu Feisty&lt;/a&gt; and decided you still want to use Ubuntu Feisty.&lt;/p&gt;

&lt;p&gt;No problem, let's go ahead and upgrade from Ubuntu LTS to Ubuntu Feisty.&lt;/p&gt;
&lt;p&gt;This should only be undertaken on a new, or reinstalled, VPS with a starting base of Ubuntu LTS. If you have a working LTS server then I &lt;em&gt;strongly&lt;/em&gt; suggest leaving it as an upgrade of this magnitude will almost undoubtedly break things.&lt;/p&gt;

&lt;p&gt;First thing is to delete old entries for the VPS IP address in your known_hosts file as a reinstalled Slice/VPS will have an old RSA key:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;nano ~/.ssh/known_hosts&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you are not using Linux on your LOCAL computer, the location of the known_hosts file will differ. Please refer to your own OS for details of where this file is kept.&lt;/p&gt;

&lt;h3&gt;Log in&lt;/h3&gt;

&lt;p&gt;Log into your minimal Ubuntu LTS server:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ssh root@123.45.67.890&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Accept the RSA key and enter the root password supplied on the Slice/VPS reinstall.&lt;/p&gt;

&lt;p&gt;Once logged in, change the root password to one of your choosing as we'll need it later on the reboot.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;passwd&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Let's see what we're using:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cat /etc/issue
#Ubuntu 6.06 LTS \n \l&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;First upgrade&lt;/h3&gt;

&lt;p&gt;Although it's possible to upgrade straight from LTS to Feisty it is &lt;em&gt;not&lt;/em&gt; recommended. The Ubuntu documentation strongly suggests the slightly longer route I will show here.&lt;/p&gt;

&lt;p&gt;So we need to upgrade LTS to Edgy and then Edgy to Feisty. The whole process takes around 5 minutes so it's not an arduous task.&lt;/p&gt;

&lt;p&gt;First thing is to update the sources.list:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;nano /etc/apt/sources.list&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Delete the default entries and add this list:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;deb http://archive.ubuntu.com/ubuntu/ edgy main restricted universe
deb-src http://archive.ubuntu.com/ubuntu/ edgy main restricted universe

deb http://archive.ubuntu.com/ubuntu/ edgy-updates main restricted universe
deb-src http://archive.ubuntu.com/ubuntu/ edgy-updates main restricted universe

deb http://security.ubuntu.com/ubuntu edgy-security main restricted universe
deb-src http://security.ubuntu.com/ubuntu edgy-security main restricted universe&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Once done, we need to enter a series of update/upgrade commands. All are required so don't think I've repeated myself unnecessarily:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;aptitude update
aptitude dist-upgrade &amp;lt;-- follow on-screen instructions
aptitude dist-upgrade &amp;lt;-- Courier = No&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then a few more:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;aptitude update
aptitude dist-upgrade
aptitude -f install
dpkg --configure -a&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Reboot&lt;/h3&gt;

&lt;p&gt;Once done, reboot the machine:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;shutdown -r now&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Log back in and have a look at what the VPS is running:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cat /etc/issue
#Ubuntu 6.10 \n \l&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Second upgrade&lt;/h3&gt;

&lt;p&gt;Thankfully, the upgrade from Edgy to Feisty is much easier as they provide a simple tool that does the hard work for us:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;aptitude install update-manager-core&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Once installed run:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;do-release-upgrade&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;There are a few question to answer. The first is to accept the SSH connection (it defaults to 'no').&lt;/p&gt;

&lt;p&gt;Then follow the on-screen instructions such as removing obsolete packages (Y), to fully ugprade, please restart (Y) and so on.&lt;/p&gt;

&lt;h3&gt;Final log in&lt;/h3&gt;

&lt;p&gt;The last reboot was automatic so log into the VPS and have a look at what it's running:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cat /etc/issue
#Ubuntu 7.04 \n \l&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And a final update/upgrade:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;aptitude update
aptitude upgrade
aptitude dist-upgrade&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Done&lt;/h3&gt;

&lt;p&gt;That's it. As said, this should only be performed on a new, or reinstalled, VPS. Now you have a minimal Ubuntu Feisty install to work with.&lt;/p&gt;

&lt;p&gt;PickledOnion.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.usefuljaja.com/">
    <author>
      <name>PickledOnion</name>
    </author>
    <id>tag:www.usefuljaja.com,2007-08-13:253</id>
    <published>2007-08-13T11:51:00Z</published>
    <updated>2007-08-13T11:52:06Z</updated>
    <category term="MySQL"/>
    <category term="mysql"/>
    <link href="http://www.usefuljaja.com/2007/8/mysql-reset-a-lost-root-password" rel="alternate" type="text/html"/>
    <title>MySQL - reset a lost root password</title>
<summary type="html">&lt;p&gt;There may well be a time where you lose or forget your MySQL root password. This may well, as you can imagine, turn out to be a complete disaster.&lt;/p&gt;

&lt;p&gt;OK, so we shouldn't lose root passwords. But what happens if we do?&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;There may well be a time where you lose or forget your MySQL root password. This may well, as you can imagine, turn out to be a complete disaster.&lt;/p&gt;

&lt;p&gt;OK, so we shouldn't lose root passwords. But what happens if we do?&lt;/p&gt;
&lt;p&gt;Resetting the MySQL root password is actually quite easy to do.&lt;/p&gt;

&lt;p&gt;However, you do need to have sudo access as we are going to use the sudo command. Not every user will be able to reset the MySQL root password whenever they feel like it!&lt;/p&gt;

&lt;h3&gt;Stop&lt;/h3&gt;

&lt;p&gt;Let's go. Log into your VPS and stop mysql:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo /etc/init.d/mysql stop&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Naturally you will have to enter your user password and, if you have sudo privileges, mysql will be stopped.&lt;/p&gt;

&lt;h3&gt;Reset password&lt;/h3&gt;

&lt;p&gt;Next we need to start MySQL in safe mode and ensure it does not read the database tables relating to MySQL user privileges.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo mysqld_safe --skip-grant-tables &amp;amp;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note the ampersand (&amp;amp;) at the end of the command.&lt;/p&gt;

&lt;p&gt;As we have started MySQL without referring to the GRANT table, we can log straight in as the MySQL root user:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mysql -u root&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now we are logged in, inform MySQL which database we want to use:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;use mysql;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Next, simply change the MySQL root password and flush the privileges:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;update user set password=PASSWORD(&amp;quot;mynewpassword&amp;quot;) where User='root';
flush privileges;&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Quit, stop and start&lt;/h3&gt;

&lt;p&gt;The MySQL root password has been reset so now we need to quit from the safe mode:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;quit&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then stop the safe version of MySQL and start the full version which will reference the user privileges we just updated:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo /etc/init.d/mysql stop
...
sudo /etc/init.d/mysql start&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;log in&lt;/h3&gt;

&lt;p&gt;Now simply log in as the root user and use the newly set password:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mysql -u root -p&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Simple as that.&lt;/p&gt;

&lt;p&gt;PickledOnion.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.usefuljaja.com/">
    <author>
      <name>PickledOnion</name>
    </author>
    <id>tag:www.usefuljaja.com,2007-08-08:233</id>
    <published>2007-08-08T18:41:00Z</published>
    <updated>2007-08-13T10:39:12Z</updated>
    <category term="MySQL"/>
    <category term="mysql"/>
    <link href="http://www.usefuljaja.com/2007/8/mysql-creating-and-editing-users" rel="alternate" type="text/html"/>
    <title>MySQL - creating and editing users</title>
<summary type="html">&lt;p&gt;Adding MySQL users follows the same principles as adding system users. Each user can be assigned different privileges to different databases. &lt;/p&gt;

&lt;p&gt;Privileges can range from read only for a single database to full MySQL wide administrator rights.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;Adding MySQL users follows the same principles as adding system users. Each user can be assigned different privileges to different databases. &lt;/p&gt;

&lt;p&gt;Privileges can range from read only for a single database to full MySQL wide administrator rights.&lt;/p&gt;
&lt;p&gt;You need administrator rights to create a new MySQL user so log into MySQL as the root user:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mysql -u root -p&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Create&lt;/h3&gt;

&lt;p&gt;Let's start off by creating a new MySQL user called 'paul':&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;CREATE USER 'paul'@'localhost' IDENTIFIED BY 'newpassword';
FLUSH PRIVILEGES;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As before, the syntax is straightforward, we created the user 'paul' who can access MySQL locally and assigned a password.&lt;/p&gt;

&lt;p&gt;We 'flushed' the privileges. Cool. This simply reloaded the 'user' table in the mysql database so MySQL can use the new user details. Do this each time you change users and privilege levels.&lt;/p&gt;

&lt;h3&gt;Grant&lt;/h3&gt;

&lt;p&gt;We can now assign some privileges to paul. I'd like him to be able to read all the databases but not be able to add or drop data:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;GRANT SELECT ON * . * TO 'paul'@'localhost';&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So now paul can select data from all the databases but we also want paul to have admin privileges over the pickled1 database:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;GRANT ALL PRIVILEGES ON `pickled1` . * TO 'paul'@'localhost';&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Paul now has full privileges on the pickled1 database and select only on the others.&lt;/p&gt;

&lt;h3&gt;Log in&lt;/h3&gt;

&lt;p&gt;OK. Lets test this new user. Log out of MySQL:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;quit&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And then log in using the user 'paul':&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mysql -u paul -p&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Enter the new password and then enter the command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;SHOW databases;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As we gave paul 'select' privileges on all databases, you'll see a list of available ones.&lt;/p&gt;

&lt;h3&gt;Drop&lt;/h3&gt;

&lt;p&gt;We know that of the databases listed, the one called 'mysql' holds the users details and is, in fact, the most important database there. Without it things would be very messy indeed.&lt;/p&gt;

&lt;p&gt;Let's go ahead and drop it.....&lt;/p&gt;

&lt;p&gt;What?&lt;/p&gt;

&lt;p&gt;You are now logged in as the user 'paul'. We gave paul all privileges on the pickled1 database but select only privileges on the other databases.&lt;/p&gt;

&lt;p&gt;Firstly, &lt;em&gt;make sure&lt;/em&gt; you are logged in as paul and have assigned privileges as above.&lt;/p&gt;

&lt;p&gt;Secondly this does a couple of things: It puts some trust in the programme and, more importantly, it builds confidence in what you are doing. You know you have assigned select only privileges on the other databases so now is the time to put it to the test:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;DROP database mysql;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This is what happened when I did it:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ERROR 1044 (42000): Access denied for user 'paul'@'localhost' to database 'mysql'&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Different privileges give different permissions.&lt;/p&gt;

&lt;h3&gt;Levels&lt;/h3&gt;

&lt;p&gt;Now we've got that out of the way, we can briefly look at the different levels of privileges available. I'm not going to go through them all but the basics you need are:&lt;/p&gt;

&lt;p&gt;For data manipulation:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;SELECT........read only
INSERT........insert rows/data
UPDATE.......change inserted rows/data
DELETE.......delete drop rows of data&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;For table manipulation:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;CREATE......create new tables
ALTER........change table/column names
DROP.........drop columns/tables&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Examples&lt;/h3&gt;

&lt;p&gt;Remember that privileges can only be assigned by the root user (well, at this point anyway) so make sure you are logged in as the root user when granting privileges.&lt;/p&gt;

&lt;p&gt;1: You have a user (paul) who you want to be able to access all data. He will enter data, correct errors and so on. But you do not want paul to be able to alter the database structure:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;GRANT SELECT , INSERT , UPDATE , DELETE ON `pickled1` . * TO 'paul'@'localhost';&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;2: You have another user (called, err, paul) who you want to be able to alter the structure of the table:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;GRANT CREATE , DROP , INDEX , ALTER ON `pickled1` . * TO 'paul'@'localhost';&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And so on. Assign privileges as needed.&lt;/p&gt;

&lt;h3&gt;Remove&lt;/h3&gt;

&lt;p&gt;Lastly, we want to be able to remove a user when they become redundant (in all senses of the word):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;DROP USER 'paul'@'localhost';&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Quite a lot going on in this article, but I hope you can see how easy it is to fine tune your MySQL users so they can't cause havoc within your MySQL database.&lt;/p&gt;

&lt;p&gt;PickledOnion.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.usefuljaja.com/">
    <author>
      <name>PickledOnion</name>
    </author>
    <id>tag:www.usefuljaja.com,2007-08-07:231</id>
    <published>2007-08-07T15:23:00Z</published>
    <updated>2007-08-07T15:26:38Z</updated>
    <category term="MySQL"/>
    <category term="mysql"/>
    <link href="http://www.usefuljaja.com/2007/8/mysql-creating-records-and-adding-columns" rel="alternate" type="text/html"/>
    <title>MySQL - creating records and adding columns</title>
<summary type="html">&lt;p&gt;Now we have the database and the first table created we can start adding records.&lt;/p&gt;

&lt;p&gt;Again, this is very easy via the command line. We'll also add another column to the table, change existing records and delete unwanted records.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;Now we have the database and the first table created we can start adding records.&lt;/p&gt;

&lt;p&gt;Again, this is very easy via the command line. We'll also add another column to the table, change existing records and delete unwanted records.&lt;/p&gt;
&lt;p&gt;As usual, log into MySQL and tell it which database we are going to use:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mysql -u root -p
...
use pickled1;&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Insert&lt;/h3&gt;

&lt;p&gt;Let's insert our first record. It's the email address of Dave, the guy who sits next to me at work:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;INSERT INTO `colleagues` (`id` ,`email`)
VALUES
(NULL , 'dave@domain.com');&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I find it easier to spread the command (especially as they get longer and more complicated) over several lines. It cleans the code up and makes it easier to review. Remember that MySQL will only execute the code once it reaches the semi-colon at the end.&lt;/p&gt;

&lt;p&gt;The syntax order is pretty simple - name the columns and then enter the values you want in the columns. We entered NULL for the id as we set the id column to AUTO_INCREMENT.&lt;/p&gt;

&lt;h3&gt;Select&lt;/h3&gt;

&lt;p&gt;Let's see what was actually entered by selecting all entries in the colleagues table:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;SELECT * FROM `colleagues`;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The output is exactly as expected - the id has a value of '1' and the email is as we entered.&lt;/p&gt;

&lt;h3&gt;Alter&lt;/h3&gt;

&lt;p&gt;Notice anything about the table? Well, I don't think it's too useful yet as I don't know who dave@domain.com is. I might remember now but not after I add the 3 other Dave's that I know.&lt;/p&gt;

&lt;p&gt;I think we need to add a column called 'name'. Not only that, I want the column to come straight after the id column. That way, I can read the records like a book: id -&gt; name -&gt; email.&lt;/p&gt;

&lt;p&gt;Let's do that:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ALTER TABLE `colleagues` ADD `name` VARCHAR( 45 ) NULL AFTER `id` ;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now when we do a:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;SELECT * FROM `colleagues`;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We see the new column entered but its value is 'NULL'.&lt;/p&gt;

&lt;h3&gt;Update&lt;/h3&gt;

&lt;p&gt;Let's insert a name:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;UPDATE `colleagues` 
SET 
`name` = 'Dave Farquat' 
WHERE `colleagues`.`id` =1 ;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Again, I don't think the syntax needs too much explaining but do note the 'WHERE' line. Without this, all records would be updated to the name 'Dave Farquat' whereas we only wanted to update the record with the unique id of 1.&lt;/p&gt;

&lt;h3&gt;Insert&lt;/h3&gt;

&lt;p&gt;Let's add one more full record:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;INSERT INTO `colleagues` 
(`id` , `name` , `email`)
VALUES 
(NULL , 'Paul Tomes', 'paul@domain.com');&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Nice.&lt;/p&gt;

&lt;h3&gt;Delete&lt;/h3&gt;

&lt;p&gt;Dave spilled coffee on me earlier. Now I want to delete his record from the colleagues table. We do this will a simple:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;DELETE FROM `colleagues` WHERE `colleagues`.`id` = 1;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Well, that's him gone.&lt;/p&gt;

&lt;p&gt;In the next article, we'll add another user and give them restricted privileges so they can only access the pickled1 database.&lt;/p&gt;

&lt;p&gt;PickledOnion&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.usefuljaja.com/">
    <author>
      <name>PickledOnion</name>
    </author>
    <id>tag:www.usefuljaja.com,2007-08-06:228</id>
    <published>2007-08-06T13:51:00Z</published>
    <updated>2007-08-07T15:25:40Z</updated>
    <category term="MySQL"/>
    <category term="mysql"/>
    <link href="http://www.usefuljaja.com/2007/8/mysql-creating-and-deleting-tables" rel="alternate" type="text/html"/>
    <title>MySQL - creating and deleting tables</title>
<summary type="html">&lt;p&gt;Once you have your database created you will want some tables in there.&lt;/p&gt;

&lt;p&gt;There are some application frameworks, such as Ruby on Rails, where all you have to do is create the database: the rest is done within the framework itself. However, it is always a good idea to know how to create tables.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;Once you have your database created you will want some tables in there.&lt;/p&gt;

&lt;p&gt;There are some application frameworks, such as Ruby on Rails, where all you have to do is create the database: the rest is done within the framework itself. However, it is always a good idea to know how to create tables.&lt;/p&gt;
&lt;p&gt;So now we have the database 'pickled1' created (see &lt;a href=&quot;http://www.usefuljaja.com/2007/8/mysql-creating-and-deleting-a-database&quot; title=&quot;Creating and deleting databases&quot;&gt;creating/deleting databases&lt;/a&gt;), we need to add a couple of tables.&lt;/p&gt;

&lt;p&gt;So, log into MySQL:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mysql -u root -p&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Use&lt;/h3&gt;

&lt;p&gt;First of all, we need to tell MySQL which database we are going to be working with. If we just told it to create some tables, it would not know which database to add them to:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;use pickled1;&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Create&lt;/h3&gt;

&lt;p&gt;Our first table is very simple and is called 'friends'. All this table will do is hold a unique ID for each friend and their email address (Let's not worry about how to enter the friend's details  - at least not yet anyway).&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;CREATE TABLE `friends` (
   id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
   email VARCHAR(45)
  );&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;OK. So what happened there?&lt;/p&gt;

&lt;p&gt;The first column (id) was defined as an integer (INT), it must have a value (NOT NULL) and is the PRIMARY KEY (this uniquely identifies the row) and will be incremented automatically.&lt;/p&gt;

&lt;p&gt;The second column will contain an email address and we have limited the text input to 45 characters.&lt;/p&gt;

&lt;h3&gt;Show&lt;/h3&gt;

&lt;p&gt;Let's take a look and see if the table was created:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;SHOW tables;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and to show the columns:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;SHOW columns FROM friends;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The output is nicely formatted and shows all the details we just entered.&lt;/p&gt;

&lt;h3&gt;Rename&lt;/h3&gt;

&lt;p&gt;Naturally, we want to be able to manipulate the table and we've now decided that the table name is a bit misleading as the list will include people from work.&lt;/p&gt;

&lt;p&gt;So let's rename it 'colleagues':&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;RENAME TABLE friends TO colleagues;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That's better.&lt;/p&gt;

&lt;h3&gt;Drop&lt;/h3&gt;

&lt;p&gt;Should you decide you want to delete the table entirely, it's just a case of 'dropping' the table:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;DROP TABLE colleagues;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I'm sure you are beginning to see that the syntax is fairly logical - show, rename, drop and so on.&lt;/p&gt;

&lt;p&gt;That's it. In the &lt;a href=&quot;http://www.usefuljaja.com/2007/8/mysql-creating-records-and-adding-columns&quot; title=&quot;Creating records and adding columns&quot;&gt;next article&lt;/a&gt; we will start to add records (data) to our table, manipulate them, delete them and so on.&lt;/p&gt;

&lt;p&gt;PickledOnion.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.usefuljaja.com/">
    <author>
      <name>PickledOnion</name>
    </author>
    <id>tag:www.usefuljaja.com,2007-08-04:225</id>
    <published>2007-08-04T13:56:00Z</published>
    <updated>2007-08-04T14:09:43Z</updated>
    <category term="Litespeed"/>
    <category term="litespeed"/>
    <link href="http://www.usefuljaja.com/2007/8/litespeed-pdf-list-of-tutorials" rel="alternate" type="text/html"/>
    <title>Litespeed - PDF list of tutorials</title>
<summary type="html">&lt;p&gt;I know it's old fashioned, but sometimes it's nice not to have to visit a website or read an RSS feed when you want to find a specific article.&lt;/p&gt;

&lt;p&gt;As such, please feel free to download a PDF of the Litespeed articles and tutorials.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;I know it's old fashioned, but sometimes it's nice not to have to visit a website or read an RSS feed when you want to find a specific article.&lt;/p&gt;

&lt;p&gt;As such, please feel free to download a PDF of the Litespeed articles and tutorials.&lt;/p&gt;
&lt;p&gt;The PDF contains a list of all the articles along with a short description and a direct link to the tutorial.&lt;/p&gt;

&lt;p&gt;Most browsers will show the PDF in the same window so to save it, you may need to right click on the link and 'save target as' or 'save link as'.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.usefuljaja.com/assets/2007/8/4/usefuljaja_litespeed.pdf&quot; title=&quot;Litespeed Tutorial PDF&quot;&gt;Litespeed Tutorial PDF&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Any suggestions always gratefully received.&lt;/p&gt;

&lt;p&gt;Pickledonion.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.usefuljaja.com/">
    <author>
      <name>PickledOnion</name>
    </author>
    <id>tag:www.usefuljaja.com,2007-08-04:224</id>
    <published>2007-08-04T11:16:00Z</published>
    <updated>2007-08-06T18:20:31Z</updated>
    <category term="MySQL"/>
    <category term="mysql"/>
    <link href="http://www.usefuljaja.com/2007/8/mysql-creating-and-deleting-a-database" rel="alternate" type="text/html"/>
    <title>MySQL - creating and deleting a database</title>
<summary type="html">&lt;p&gt;Following this MySQL series will see us creating a database called 'pickled1', adding tables, columns, rows (data) and specifying MySQL users for the 'pickled1' database.&lt;/p&gt;

&lt;p&gt;We can start by deleting any redundant databases and creating our new 'pickled1' database.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;Following this MySQL series will see us creating a database called 'pickled1', adding tables, columns, rows (data) and specifying MySQL users for the 'pickled1' database.&lt;/p&gt;

&lt;p&gt;We can start by deleting any redundant databases and creating our new 'pickled1' database.&lt;/p&gt;
&lt;p&gt;Log into MySQL:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mysql -u root -p&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We know what databases are installed by default (see &lt;a href=&quot;http://www.usefuljaja.com/2007/8/mysql-listing-installed-databases&quot; title=&quot;Listing installed databases&quot;&gt;listing databases&lt;/a&gt;) and discovered that some OS's have a database called 'test' installed by default.&lt;/p&gt;

&lt;h3&gt;Drop&lt;/h3&gt;

&lt;p&gt;Let's delete the 'test' database straight away:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;DROP DATABASE test;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That was pretty simple. The entire 'test' database has gone.&lt;/p&gt;

&lt;p&gt;Have a look:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;SHOW databases;&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Create&lt;/h3&gt;

&lt;p&gt;Let's go ahead and create a new database called 'pickled1'.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;CREATE DATABASE pickled1;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Have a look:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;SHOW databases;&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Shortcuts&lt;/h3&gt;

&lt;p&gt;You know what? I still find that too much work. You have to log into MySQL and then create the database and then logout. Seems like a long way around.&lt;/p&gt;

&lt;p&gt;Luckily there is a shortcut you can use when creating databases (you know, I think the plural should databi, like ocutpi...).&lt;/p&gt;

&lt;p&gt;Anyway, to create the same database with just one line would be:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mysqladmin -u root -p create pickled1&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Enter your password (if you have one) and that's it. The 'pickled1' database has been created. Now that's more like it.&lt;/p&gt;

&lt;p&gt;What about dropping databases with one line?&lt;/p&gt;

&lt;p&gt;OK. Let's do this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mysqladmin -u root -p drop pickled1&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Again, it'll ask for a password and is then kind enough to ask if we really want to drop the database. It has a point - it is potentially a very bad thing to do.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Database &amp;quot;pickled1&amp;quot; dropped&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Nice.&lt;/p&gt;

&lt;h3&gt;Naming Conventions&lt;/h3&gt;

&lt;p&gt;There are some rules you have to follow when creating a MySQL databases but they are pretty simple:&lt;/p&gt;

&lt;p&gt;The database name must be no longer than 64 bytes.&lt;/p&gt;

&lt;p&gt;Note this is not characters but bytes as some characters can contain more than one byte. Don't be too concerned about this - just don't use ridiculously long names.&lt;/p&gt;

&lt;p&gt;Secondly, the name must not contain:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;forward slash (/)&lt;/li&gt;
&lt;li&gt;back slash ()&lt;/li&gt;
&lt;li&gt;periods (.)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's it. As before, I am sure you can see the advantage of using the command line rather than a MySQL gui for these sorts of queries.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;http://www.usefuljaja.com/2007/8/mysql-creating-and-deleting-tables&quot; title=&quot;Creating and deleting tables&quot;&gt;next article&lt;/a&gt; discusses creating, renaming and deleting tables within the new database.&lt;/p&gt;

&lt;p&gt;PickledOnion.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.usefuljaja.com/">
    <author>
      <name>PickledOnion</name>
    </author>
    <id>tag:www.usefuljaja.com,2007-08-04:223</id>
    <published>2007-08-04T10:41:00Z</published>
    <updated>2007-08-06T18:03:59Z</updated>
    <category term="MySQL"/>
    <category term="mysql"/>
    <link href="http://www.usefuljaja.com/2007/8/mysql-listing-installed-databases" rel="alternate" type="text/html"/>
    <title>MySQL - listing installed databases</title>
<summary type="html">&lt;p&gt;Now we have a root password set, let's see what databases are installed by default in MySQL.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;Now we have a root password set, let's see what databases are installed by default in MySQL.&lt;/p&gt;
&lt;p&gt;Let's get stuck in straight away. SSH into your VPS and then log into MySQl:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mysql -u root -p&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Enter your password (if you set one).&lt;/p&gt;

&lt;p&gt;This series of MySQL tutorials will be using MySQL version 5.x. If you are using an earlier version some of these commands may not work as suggested. This is because MySQL v5.x introduces new features and new commands. However, I will try to ensure they are as compatible as possible.&lt;/p&gt;

&lt;p&gt;There are two ways of listing the databases. Firstly:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;SHOW databases;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Fairly simple but do note the semi-colon (;) at the end of the MySQL command. All commands in MySQL require a semi-colon at the end. This lets MySQL know that you have finished typing the command and to execute what you have typed.&lt;/p&gt;

&lt;p&gt;That may seem odd but the commands can span several different lines and only when MySQL encounters the semi-colon will it execute the code.&lt;/p&gt;

&lt;p&gt;The output on my test machine is as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
+--------------------+
2 rows in set (0.00 sec)&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This tells me that I have two databases installed by default: information_schema and mysql.&lt;/p&gt;

&lt;p&gt;We're not going to worry about those right now. We're only seeing what's there.&lt;/p&gt;

&lt;p&gt;The second way of listing the databases in MySQL is very similar except it uses the word 'schemas' instead of 'databases'. This is simply another way of referring to a database.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;SHOW schemas;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The output is exactly the same:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
+--------------------+
2 rows in set (0.00 sec)&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In general, we will be using the word 'database' instead of 'schema' as although they mean the same thing in MySQL, I have been reliably informed (thanks Ron) that 'schema' can, and does, mean slightly different things on other database software such as postgresql.&lt;/p&gt;

&lt;p&gt;Just something to keep in mind if you do use other DB software.&lt;/p&gt;

&lt;p&gt;If you are using a different OS than Debian Etch you may well see a third database named 'test'.&lt;/p&gt;

&lt;p&gt;It is a very good idea to delete this straight away and the &lt;a href=&quot;http://www.usefuljaja.com/2007/8/mysql-creating-and-deleting-a-database&quot; title=&quot;Creating and Deleting Schemas&quot;&gt;next article&lt;/a&gt; concentrates on creating and deleting schemas.&lt;/p&gt;

&lt;p&gt;PickledOnion&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.usefuljaja.com/">
    <author>
      <name>PickledOnion</name>
    </author>
    <id>tag:www.usefuljaja.com,2007-08-03:221</id>
    <published>2007-08-03T16:42:00Z</published>
    <updated>2007-08-06T13:59:52Z</updated>
    <category term="MySQL"/>
    <category term="mysql"/>
    <link href="http://www.usefuljaja.com/2007/8/setting-the-mysql-root-password" rel="alternate" type="text/html"/>
    <title>Setting the MySQL root password</title>
<summary type="html">&lt;p&gt;Setting a MySQL root password is considered by some to be a waste of time. But then some also believe having a firewall or wearing a seatbelt are a waste of time.&lt;/p&gt;

&lt;p&gt;Setting a MySQL root password is very simple and is the first thing you should do on installing the MySQL database.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;Setting a MySQL root password is considered by some to be a waste of time. But then some also believe having a firewall or wearing a seatbelt are a waste of time.&lt;/p&gt;

&lt;p&gt;Setting a MySQL root password is very simple and is the first thing you should do on installing the MySQL database.&lt;/p&gt;
&lt;p&gt;When you first install MySQL it won't have a password set for the root user. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Don't confuse the MySQL root user with the system root user.&lt;/p&gt;

&lt;p&gt;Although both users have the same philosophy behind them in that they are admin users with full permissions, the MySQL root user is only used when accessing databases and when using MySQL from the command line. It cannot do anything 'outside' of MySQL.&lt;/p&gt;

&lt;p&gt;So to start this MySQL series, we will set the MySQL root user password. There are a couple of ways of doing this, but we are going to log into MySQL to set it.&lt;/p&gt;

&lt;p&gt;This does a couple of things. Naturally, it will set the password (!) but it will also introduce you to the MySQL command line. &lt;/p&gt;

&lt;p&gt;Just as with BASH, you should not be intimidated by using the command line. It is easy to learn and is as powerful as you want it to be. There are plenty of external gui faces to MySQL and indeed, I occasionally use them. But it is useful to learn at least the basics of the command line for there will be a time that entering a couple of commands is far easier than firing up another programme to complete a simple task.&lt;/p&gt;

&lt;p&gt;Let's get stuck right in. Log onto your VPS and find out the hostname of your server. You will probably know this already but if not, you can enter the command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;hostname
#shallot&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As you can see, my server's hostname is 'shallot'. I'll explain why we need this is a moment.&lt;/p&gt;

&lt;p&gt;Now we get to use MySQL via the command line. Simply enter 'mysql:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mysql -u root -p&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The -u option specifies the user. In this case the user is root. The -p option means a password will be required. Just hit enter/return when asked as there is no password (yet).&lt;/p&gt;

&lt;p&gt;A little tip is to set an alias in your .bash_profile to shorten this command. For example, I have:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;alias mysqll=&amp;quot;mysql -u root -p&amp;quot;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So when I enter the command 'mysqll' it will execute the full 'mysql -u root -p' code. &lt;/p&gt;

&lt;p&gt;You will be greeted with some information regarding version and some tips on getting help:&lt;/p&gt;

&lt;p class=&quot;image&quot;&gt;&lt;a href=&quot;http://www.usefuljaja.com/assets/2007/8/3/mysql03.png&quot; title=&quot;MySQL Login&quot;&gt;&lt;img src=&quot;http://www.usefuljaja.com/assets/2007/8/3/mysql03_thumb.png&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As this is our first foray into the MySQL command line, let's set the password and leave.&lt;/p&gt;

&lt;p&gt;To set the password enter:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpasswordhere');&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Change 'yourpasswordhere' for a password of your choosing and note the semi-colon (;) at the end of the command. &lt;/p&gt;

&lt;p&gt;The output is pretty straight forward:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Query OK, 0 rows affected (0.00 sec)&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That tells us that the 'Query' (the command we entered) went OK.&lt;/p&gt;

&lt;p&gt;That's almost it.&lt;/p&gt;

&lt;p&gt;Remember we got the hostname of your VPS? Well, there is more than one way to connect to MySQL. One is from localhost and the other is via the hostname of your machine:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;SET PASSWORD FOR 'root'@'shallot' = PASSWORD('yourpasswordhere');&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Notice how I have my hostname ('shallot') in the command? As it's the same user, just with different ways of connecting, use the same password as before. We won't have to worry about that again.&lt;/p&gt;

&lt;p&gt;Finally, you need to reload the privileges and then leave the MySQL command line:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;FLUSH PRIVILEGES;
quit;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;MySQL is very polite and will say 'Bye' before putting you back on the BASH command line.&lt;/p&gt;

&lt;p&gt;As you can see, using MySQL is very simple and very quick. It would not have been worth starting a gui interface just for this.&lt;/p&gt;

&lt;p&gt;The next articles will concentrate on creating databases, tables, columns, users and all the good stuff that databases are used for.&lt;/p&gt;

&lt;p&gt;PickledOnion.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.usefuljaja.com/">
    <author>
      <name>PickledOnion</name>
    </author>
    <id>tag:www.usefuljaja.com,2007-08-02:219</id>
    <published>2007-08-02T19:52:00Z</published>
    <updated>2007-08-02T19:56:00Z</updated>
    <category term="Litespeed"/>
    <category term="Subversion"/>
    <category term="rails"/>
    <category term="subversion"/>
    <link href="http://www.usefuljaja.com/2007/8/subversion-rails-and-litespeed-primer" rel="alternate" type="text/html"/>
    <title>Subversion, Rails and Litespeed primer</title>
<summary type="html">&lt;p&gt;You are probably using version control for you projects. Even for a lone developer, subversion makes life much easier.&lt;/p&gt;

&lt;p&gt;As some point you will test your application in Litespeed. Any commits to subversion after that will include compressed files ending with .lsz and logs full of outdated files. Let's set up the application to ignore certain files when committing changes.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;You are probably using version control for you projects. Even for a lone developer, subversion makes life much easier.&lt;/p&gt;

&lt;p&gt;As some point you will test your application in Litespeed. Any commits to subversion after that will include compressed files ending with .lsz and logs full of outdated files. Let's set up the application to ignore certain files when committing changes.&lt;/p&gt;
&lt;p&gt;The base for this article came from Ryan Bates' excellent &lt;a href=&quot;http://railscasts.com&quot; title=&quot;Railscasts&quot;&gt;Railscasts&lt;/a&gt; series and extends episode 36 for Litespeed use.&lt;/p&gt;

&lt;p&gt;I'll assume you have subversion set up on your server. If not, refer to the &lt;a href=&quot;http://www.usefuljaja.com/subversion&quot; title=&quot;usefuljaja.com subversion articles&quot;&gt;subversion&lt;/a&gt; articles for an introduction and explanation.&lt;/p&gt;

&lt;p&gt;let's start by creating a base Ruby on Rails application and moving into the directory:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;rails rails_app
cd rails_app&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Next move database.yml and remove the log and tmp files:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mv config/database.yml config/database_example.yml
rm -r log/*
rm -r tmp/*&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Import&lt;/h3&gt;

&lt;p&gt;That's the first part done so now import the application to subversion:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;svn import /home/paul/rails_app/ file:///home/paul/repository/rails_app/trunk -m &amp;quot;Initial import of rails_app&amp;quot;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now delete the original rails_app folder as we no longer need it:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cd ..
rm -rf rails_app&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Check Out&lt;/h3&gt;

&lt;p&gt;Now we're free to check out rails_app from the repository and configure it to ignore certain files and directories in any future commit:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;svn co file:////home/paul/repository/rails_app/trunk rails_app
cd rails_app&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now copy the database_example.yml file back to database.yml:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cp config/database_example.yml config/database.yml&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now comes the meat of the subversion/rails primer. We're going to set the 'ignore' function on a few files so subversion will literally ignore them on any future commit.&lt;/p&gt;

&lt;h3&gt;Ignore&lt;/h3&gt;

&lt;p&gt;These files include log files, files in the rails tmp directory and files ending in .lsz in the public directory:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;svn propset svn:ignore database.yml config/
svn propset svn:ignore &amp;quot;schema.rb&amp;quot; config/
svn propset svn:ignore &amp;quot;*.xml&amp;quot; config/
svn propset svn:ignore &amp;quot;*&amp;quot; log/
svn propset svn:ignore &amp;quot;*&amp;quot; tmp/
svn propset svn:ignore &amp;quot;*doc&amp;quot; doc/
svn propset svn:ignore &amp;quot;*.lsz&amp;quot; public/
svn propset svn:ignore &amp;quot;*.lsz&amp;quot; public/javascripts/
svn propset svn:ignore &amp;quot;*.lsz&amp;quot; public/stylesheets/&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you are swapping between Windows and Linux workstations when you develop your application, you will also need to set the subversion 'executable' flag on some files:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;svn propset svn:executable &amp;quot;*&amp;quot; `find script -type f | grep -v '.svn'` public/dispatch.*&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Commit&lt;/h3&gt;

&lt;p&gt;Finally you need to commit your changes to the subversion repository:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;svn commit -m &amp;quot;ignoring certain files in rails_app&amp;quot;&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Tips&lt;/h3&gt;

&lt;p&gt;There should be no need to 'add' files using 'svn add xxxxx' if you use the -c flag with script/generate.&lt;/p&gt;

&lt;p&gt;The -c (or --svn) flag informs subversion of any new files so all you have to do is commit the changes.&lt;/p&gt;

&lt;p&gt;An example (with output):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;script/generate model user -c

      exists  app/models/
      exists  test/unit/
      exists  test/fixtures/
      create  app/models/user.rb
A    app/models/user.rb
      create  test/unit/user_test.rb
A    test/unit/user_test.rb
      create  test/fixtures/users.yml
A    test/fixtures/users.yml
      create  db/migrate
A    db/migrate
      create  db/migrate/001_create_users.rb
A    db/migrate/001_create_users.rb&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Pretty cool. Rails has automatically let subversion know about the new files. Saves us time as all we have to do is commit the changes.&lt;/p&gt;

&lt;p&gt;PickledOnion.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.usefuljaja.com/">
    <author>
      <name>PickledOnion</name>
    </author>
    <id>tag:www.usefuljaja.com,2007-08-01:214</id>
    <published>2007-08-01T17:02:00Z</published>
    <updated>2007-08-01T17:17:49Z</updated>
    <category term="Litespeed"/>
    <category term="Subversion"/>
    <category term="rails"/>
    <category term="subversion"/>
    <link href="http://www.usefuljaja.com/2007/8/litespeed-browsing-subversion-repositories" rel="alternate" type="text/html"/>
    <title>Litespeed - Browsing subversion repositories</title>
<summary type="html">&lt;p&gt;Litespeed does not support browsing subversion repositories in the way that the Apache webserver does.&lt;/p&gt;

&lt;p&gt;This does not leave us high and dry though as there are plenty of third party products that allow us to browse the repository quite happily whilst using svnserve to check-out and commit any changes.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;Litespeed does not support browsing subversion repositories in the way that the Apache webserver does.&lt;/p&gt;

&lt;p&gt;This does not leave us high and dry though as there are plenty of third party products that allow us to browse the repository quite happily whilst using svnserve to check-out and commit any changes.&lt;/p&gt;
&lt;p&gt;In this article I will show you how to set up a simple Ruby on Rails application using &lt;a href=&quot;https://bssvnbrowser.bountysource.com/&quot; title=&quot;bsSvnBrowser Home Page&quot;&gt;bsSvnBrowser&lt;/a&gt; from Bounty Source.&lt;/p&gt;

&lt;p&gt;This is a free product and is released under the GPL so feel free to use it for whatever you want - just keep to the rules of the GPL.&lt;/p&gt;

&lt;p&gt;Just a quick word of warning: the documentation on the Bounty Source site needs updating and does not work with the latest release.&lt;/p&gt;

&lt;p&gt;Let's see if you want to install it first. Have a &lt;a href=&quot;http://svn.usefuljaja.com/&quot; title=&quot;Usefuljaja subversion browsing demo&quot;&gt;look at my demo&lt;/a&gt; which will allow you to browse two of my projects called user_fu and wibble_fu.&lt;/p&gt;

&lt;p&gt;Have a play with the menu and select 'revision info' from the drop down box and click 'Go!'. It'll show you exactly what was changed and when. As you can see, I really went to town with my show method (with a mistake in the syntax!).&lt;/p&gt;

&lt;p&gt;Right, I'll assume you have a subversion repository setup with at least one project imported.&lt;/p&gt;

&lt;p&gt;BsSvnBrowser will not work unless you have the ruby subversion bindings installed so let's go ahead and do that:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;## Debain:
aptitude install libsvn-ruby
## Ubuntu:
apt-get install libsvn-ruby&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you are using another distribution, please refer to the install documentation for that distro.&lt;/p&gt;

&lt;p&gt;Using 'irb', have a quick check to see if the ruby bindings have taken:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;irb
require 'svn/core'  
## =&amp;gt; true
exit&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I'm going to create a new Ruby on Rails application for the subversion browser, but you can also install it as a plugin - simply adjust the routes.rb config shown below:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;rails svn.domain.com
cd svn.domain.com&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now install the plugin:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;./script/plugin install https://svn.bountysource.com/bssvnbrowser/trunk/
mv vendor/plugins/trunk vendor/plugins/bs_svn_browser&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now we need to run a rake task to ensure the assets are linked correctly:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;rake bs:svn_browser:link_assets&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Once done, we need add a couple of lines to tell BsSvnBrowser where the repository is and to load the correct libraries:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;nano config/environment.rb 

## At the bottom add:

BsSvnBrowser.repository_path = '/home/username/repository'&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Next:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;nano  vendor/plugins/bs_svn_browser/init.rb

## At the bottom add:

require 'svn/repos'&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In this example, the SvnBrowser is all I want from the Rails application. As such, the routes.rb needs adjusting so all URL requests are routed to the correct controller:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;nano config/routes.rb

## Underneath  # map.connect '', :controller =&amp;gt; &amp;quot;welcome&amp;quot; add:

map.connect '*path',  :controller =&amp;gt; 'bs_svn_browser', :action =&amp;gt; 'distributor'&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And finally, remove the index.html file as we don't need it:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;rm public/index.html&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That's it.&lt;/p&gt;

&lt;p&gt;The Rails application is good to go. Just add the domain to Litespeed's virtual host configurations (refer to the Ruby on Rails &lt;a href=&quot;http://www.usefuljaja.com/2007/5/litespeed-serve-a-ruby-on-rails-domain&quot; title=&quot;Serve a Ruby on Rails Domain&quot;&gt;domain article&lt;/a&gt; if unsure).&lt;/p&gt;

&lt;p&gt;PickledOnion.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.usefuljaja.com/">
    <author>
      <name>PickledOnion</name>
    </author>
    <id>tag:www.usefuljaja.com,2007-07-31:213</id>
    <published>2007-07-31T15:48:00Z</published>
    <updated>2007-07-31T15:49:37Z</updated>
    <category term="Subversion"/>
    <category term="subversion"/>
    <link href="http://www.usefuljaja.com/2007/7/multiple-repositories-and-subversion" rel="alternate" type="text/html"/>
    <title>Multiple repositories and subversion</title>
<summary type="html">&lt;p&gt;Last time we looked at &lt;a href=&quot;http://www.usefuljaja.com/2007/7/multiple-projects-and-subversion&quot; title=&quot;Multiple projects and subversion&quot;&gt;multiple projects&lt;/a&gt; which was a nice way of serving multiple projects from the same repository.&lt;/p&gt;

&lt;p&gt;But what if we wanted our projects to be completely separated? Well, serving multiple repositories is the answer.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;Last time we looked at &lt;a href=&quot;http://www.usefuljaja.com/2007/7/multiple-projects-and-subversion&quot; title=&quot;Multiple projects and subversion&quot;&gt;multiple projects&lt;/a&gt; which was a nice way of serving multiple projects from the same repository.&lt;/p&gt;

&lt;p&gt;But what if we wanted our projects to be completely separated? Well, serving multiple repositories is the answer.&lt;/p&gt;
&lt;p&gt;For some reason, this is sometimes seen as a tedious and long route to serve our projects. Nothing could be further from the truth. Multiple repositories are incredibly easy to set up and to serve and do solve issues related to version numbering and so on.&lt;/p&gt;

&lt;p&gt;Let's get straight on. If you have been following the previous tutorials, you may well have project1 and project2 in the 'work' and 'repository' folders. You may also have an instance of svnserve running.&lt;/p&gt;

&lt;p&gt;Let's stop svnserve and delete the old stuff:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;killall svnserve
rm -rf /home/paul/repository
rm -rf /home/paul/work/*&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now we have a clean sheet to work from.&lt;/p&gt;

&lt;p&gt;Start by creating a folder to hold our repositories and then, using svnadmin, create two new repositories (we'll keep the naming pretty simple):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mkdir repositories

svnadmin create repositories/project1
svnadmin create repositories/project2&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Next, I'm going to create two incredibly simple projects and import them into the separate subversion repositories:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mkdir project1
touch project1/project1.txt

svn import /home/paul/project1 file:///home/paul/repositories/project1/trunk -m &amp;quot;import project1&amp;quot;

mkdir project2
touch project2/project2.txt

svn import /home/paul/project2 file:///home/paul/repositories/project2/trunk -m &amp;quot;import project2&amp;quot;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Notice that this time, for each initial import subversion reported:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Committed revision 1&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now the two projects are seperated. Had we used the technique described in the &lt;a href=&quot;http://www.usefuljaja.com/2007/7/multiple-projects-and-subversion&quot; title=&quot;Multiple projects and subversion&quot;&gt;multiple projects&lt;/a&gt; article, project2 would have been committed as revision 2.&lt;/p&gt;

&lt;p&gt;Delete the original project folders as we don't need them any more:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;rm -rf project*&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We could simply check out the projects on the same machine but that's not much fun. Let's setup svnserve to serve both repositories at the same time.&lt;/p&gt;

&lt;p&gt;This is exactly the same as when serving one repository:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;svnserve -d -r /home/paul/repositories/&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That's it. It is incredibly simple to set up. Naturally, if you have a firewall, ensure you allow connections to port 3690 (the default svnserve port).&lt;/p&gt;

&lt;p&gt;Checking out the different projects uses the same procedure as before. So from your workstation, issue the command(s):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;svn co svn://123.45.67.890/project1/trunk project1

svn co svn://123.45.67.890/project2/trunk project2&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The IP address is the address of your VPS.&lt;/p&gt;

&lt;p&gt;Add, edit and delete files as you would for any other project under subversion control. Any commits you make will be for that project only.&lt;/p&gt;

&lt;p&gt;PickledOnion.&lt;/p&gt;
          </content>  </entry>
</feed>
