<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Mysql on Matt Thornton</title>
    <link>https://matt-thornton.net/tags/mysql/</link>
    <description>Recent content in Mysql on Matt Thornton</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Wed, 23 Mar 2022 14:26:59 +0000</lastBuildDate><atom:link href="https://matt-thornton.net/tags/mysql/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>MySQL - get previous and next rows in one query</title>
      <link>https://matt-thornton.net/tech/mysql-get-previous-next-rows-in-one-query/</link>
      <pubDate>Wed, 23 Mar 2022 14:26:59 +0000</pubDate>
      
      <guid>https://matt-thornton.net/tech/mysql-get-previous-next-rows-in-one-query/</guid>
      
        <description>&lt;p&gt;Over on the &lt;a href=&#34;https://cortex.gg/blog&#34;&gt;Cortex blog&lt;/a&gt; we have a janky-ass blog system that uses some filthy PHP and MySQL to do news article type things. I wrote it, it&amp;rsquo;s disgusting, we should do better, but it is what it is.&lt;/p&gt;
&lt;p&gt;The plumber&amp;rsquo;s toilet, and all that.&lt;/p&gt;
&lt;p&gt;Pending some time to actually do it properly, we wanted to polish the turd enough that it was semi-functional - and this included having in-post navigation - so that, from a post you could either jump forward or backwards to the post. Much like on this blog. Which Hugo somehow just does automagically.&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>MySQL on Raspberry Pi - allow connections from non-localhost</title>
      <link>https://matt-thornton.net/tech/databases/mysql-raspberry-pi-allow-connections-non-localhost/</link>
      <pubDate>Wed, 06 Dec 2017 05:21:05 +0000</pubDate>
      
      <guid>https://matt-thornton.net/tech/databases/mysql-raspberry-pi-allow-connections-non-localhost/</guid>
      
        <description>&lt;p&gt;If you want to connect to MySQL from any device in your network that isn&amp;rsquo;t on localhost, then you may encounter an error:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;MySQL error: Could not connect to any of the specified hosts&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Bear in mind that e.g., a PHP web app or phpmyadmin will continue to work, since (assuming your web server such as Apache is running on the same server as MySQL) they&amp;rsquo;re technically running on localhost and will be able to connect.&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>Recovering files from broken Raspberry Pi - Part 2</title>
      <link>https://matt-thornton.net/tech/databases/recovering-files-broken-raspberry-pi-part-2/</link>
      <pubDate>Tue, 05 Dec 2017 22:43:35 +0000</pubDate>
      
      <guid>https://matt-thornton.net/tech/databases/recovering-files-broken-raspberry-pi-part-2/</guid>
      
        <description>&lt;blockquote&gt;
&lt;p&gt;This is the second part of a guide on recovering MySQL data from a broken Raspberry Pi.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Part 1: &lt;a href=&#34;https://matt-thornton.net/tech/databases/recovering-files-broken-raspberry-pi-part-1&#34;&gt;Rebuild the Raspberry Pi&lt;/a&gt;&lt;br&gt;
Part 2: Recover the MySQL data and restore to the new environment.&lt;/p&gt;
&lt;p&gt;With a newly functional Raspberry Pi, it was now time to try and recover MySQL data. Clearly this will only work if the SD card in the old Pi itself is actually functional and readable.&lt;/p&gt;
&lt;p&gt;The good news is that MySQL stores its data on the file system in a reasonably compact and accessible format. There are a few differences in structure based on whether your database tables are in MyISAM or InnoDB format. This post assumes your tables are in InnoDB format (since that&amp;rsquo;s what mine were) but as far as I know, the only difference is that if your tables are in MyISAM format, then there&amp;rsquo;s no need to copy the ibdata* files over.&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>MySQL table name case sensitivity</title>
      <link>https://matt-thornton.net/tech/mysql-table-name-case-sensitivity/</link>
      <pubDate>Sun, 01 Oct 2017 16:46:35 +0000</pubDate>
      
      <guid>https://matt-thornton.net/tech/mysql-table-name-case-sensitivity/</guid>
      
        <description>&lt;p&gt;Just encountered a fun little issue when trying to move something from a local MySQL server to a ‘Prod&amp;rsquo; server. The difference in architecture being that dev MySQL was running on OSX whereas the ‘Prod&amp;rsquo; MySQL was running on Linux (debian).&lt;/p&gt;
&lt;p&gt;The issue was that a lot of my queries/views/procedures were failing on the Linux box due to non-existence of tables. (When they definitely existed.)&lt;/p&gt;
&lt;p&gt;The problem was how different operating systems treat case sensitivity in tables. In short, on Windows and OSX table names are case insensitive. In Linux and other Unix based platforms, they are case sensitive.&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>.NET console app on Mono on Raspberry Pi writing to MySQL (compiled on a Mac)</title>
      <link>https://matt-thornton.net/tech/net-console-app-mono-raspberry-pi-writing-mysql-compiled-mac/</link>
      <pubDate>Sun, 17 Sep 2017 21:18:29 +0000</pubDate>
      
      <guid>https://matt-thornton.net/tech/net-console-app-mono-raspberry-pi-writing-mysql-compiled-mac/</guid>
      
        <description>&lt;blockquote&gt;
&lt;p&gt;Update: if you&amp;rsquo;re just looking to build a simple LAMP server on a Pi, then there is an updated version of this guide which installs more up to date versions of e.g., PHP, &lt;a href=&#34;https://www.matt-thornton.net/tech/databases/recovering-files-broken-raspberry-pi-part-1&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;For reasons I won&amp;rsquo;t go into, I have an unnecessarily complicated set of requirements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Dev environment is Windows 10 + Visual Studio 2015 running as a virtual machine inside VMWare Fusion on Max OSX 10.11.6&lt;/li&gt;
&lt;li&gt;Target application is .NET 4.5.2 running on a Raspberry Pi 3 under Mono&lt;/li&gt;
&lt;li&gt;App must write data to MySQL db&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is my first time working with Mono. It&amp;rsquo;s actually relatively straight-forward to setup, but there were one or two hoops I jumped through, so I figure this may be helpful. You could choose to use VSCode on your Mac if you didn&amp;rsquo;t want to go down the Windows dev VM route.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The main issue I encountered is the latest MySQL Connector for .NET that you get using NuGET doesn&amp;rsquo;t seem to work in Mono. The trick was to install an early version (&lt;a href=&#34;https://dev.mysql.com/downloads/file/?id=410730&#34;&gt;6.4.6 to be exact&lt;/a&gt;) and once I did this, all seemed to work OK. Have not got much further yet, so not yet sure what other issues I will encounter.&lt;/p&gt;
&lt;p&gt;This assumes you have a completely fresh copy of Raspbian latest. If you haven&amp;rsquo;t, follow a guide &lt;a href=&#34;https://www.raspberrypi.org/documentation/installation/installing-images/README.md&#34;&gt;here&lt;/a&gt;. I used &lt;a href=&#34;https://etcher.io/&#34;&gt;Etcher&lt;/a&gt; for the first time and was very impressed as it worked perfectly.&lt;/p&gt;
&lt;p&gt;I am using the &lt;a href=&#34;https://www.raspberrypi.org/downloads/raspbian/&#34;&gt;-Lite&lt;/a&gt; (no UI) version so may have had to do extra stuff that the full fat version didn&amp;rsquo;t require. I also configured Apache/PHP etc. so I could have phpmyadmin running.&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>gnucash &#43; mysql &#43; OS X 10.10: getting it running</title>
      <link>https://matt-thornton.net/tech/databases/gnucash-mysql-os-x-10-10-getting-it-running/</link>
      <pubDate>Tue, 07 Apr 2015 15:05:53 +0000</pubDate>
      
      <guid>https://matt-thornton.net/tech/databases/gnucash-mysql-os-x-10-10-getting-it-running/</guid>
      
        <description>&lt;p&gt;&lt;em&gt;This post will help you to get gnucash running with MySQL on OS X 10.10.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I do the bookkeeping and accounts for a variety of small NFPs or charitable organisations. I recently moved my bookkeeping for these from a combination of Sharepoint (seriously) and SSRS and Excel in to &lt;a href=&#34;http://gnucash.org&#34;&gt;Gnucash&lt;/a&gt;. I had been looking for a decent free app for a while and whilst there are some interesting cloud options (in fact there are a million options) I stumbled across Gnucash - a nice looking open source, cross-platform tool that would work on my Mac (without X11) and decided to go for it.&lt;/p&gt;</description>
      
    </item>
    
  </channel>
</rss>