Until recently I spent a lot of time working with Oracle from the command line (via ksh on AIX, in case you’re interested). A change of job means a change of platform and I find myself working with MySQL on a daily basis. I like MySQL – like most PHP programmers this is where I started learning about databases and I’ll always have a soft spot for it.
In Oracle most developers use SQLPlus to work with the database – its the standard command-line tool and the only thing you can guarantee being available in a new environment. It has a wonderful feature where you can type a query and then type ‘ed’ and pull up an editor window with the query still in it … so useful for debugging big statements.
I’ve been struggling to get to grips with MySQL – it has more tools and phpMyAdmin is readily available. However I don’t really use a mouse if I can help it so its not as fast or convenient as the SQLPlus + ‘ed’ combination. So here’s my discovery for this week:
Most mysql command-line tools will launch your previous query, with line breaks, if you type \e at the prompt. Fantastically useful and I’m happy and settled once more :)