Showing entries 11 to 17
« 10 Newer Entries
Displaying posts with tag: cli (reset)
Diagnosing problems with SQL imports

Importing a text file containing a list of SQL commands into MySQL is a straightforward task. All you need to do is simply feed the file contents through pipe into MySQL command line client. For example: mysql app_production < dump.sql.

The reasons for doing such imports can be very different - restoring MySQL backups created with mysqldump, manually replaying binary log events or performing database migrations during software roll-outs.

While the task is simple, the import may not end successfully and when this happens, how to tell what the problem was?

MySQL errors

Whenever database hits an error, MySQL produces an error message that describes the problem and the import process stops immediately. If the message is not clear enough, you can always refer to the reported line number, which is the line number inside the source SQL file. This way you can locate the precise command or query that …

[Read more]
MySQL CLI Hidden Gems

I am sure any of you that have used MySQL in the past have used the MySQL Command-Line tool (CLI). Here we will explore some of the less used CLI features that you may or may not be aware of.

Edit: In hindsight I should of called this post something like MySQL CLI Hiding Gems or Lesser Known Gems. These tools aren’t strictly hidden just not often used or mentioned.

System commands
You can use the system command to exectute shell commands without leaving the CLI


      mysql> system whoami
sam
mysql> system echo "Hello World"
Hello World
mysql> system uname
Darwin

The same can be done with \! instead of system.

Logging to file
The tee (\T) command can be used to specify an output file to log CLI output to.

[Read more]
Tip: how to save 10 minutes a day?

For any person actively working with MySQL databases on the command line level, logging in, logging out for a few moments, and then logging in again, all repeated many times, not only eventually becomes annoying, especially with passwords that aren’t easy to type, but it also can take a lot of time over the course of a day. For a long time I’ve been relaying on something that allows me to avoid most of this effort while working. The solution is of course not to log out unless you actually want to.

Linux, BSD and Solaris all allow suspending a running task and resuming its execution at a later time. This can be used to temporarily exit MySQL client without having it to leave the database.

When inside MySQL, you can press Ctrl+Z to suspend the client program and return to the system shell. You will be able to bring the database client back at any time by running fg command …

[Read more]
Setting up Amazon Web Services

This tutorial will help you register and get ready to use Amazon Web Service (AWS). AWS provides a free tier so it is possible to use these services at ZERO cost.

These instructions are used by the Effective MySQL: Backup and Recovery book examples.

Step 1: Registration

  1. Goto AWS site
  2. Register email address
  3. Enter Login Credentials
  4. Enter Contact Information
  5. Enter Credit Card details (while this is required, provided you follow free guidelines you will not be charged)
  6. Identity verification by Telephone
  7. Activation of account

Screenshots

[Read more]
CLI, Roller, Jersey, JavaOne... and More GlassFish News - April 27th, 2010

Install and Run Apache Roller 4.01 on GlassFish and OpenSolaris
Dave Koelmeyer has posted Detailed Instructions on how to install Apache Roller 4.01 on GlassFish v2.1 using MySQL 5.1 for storage.  He uses OpenSolaris snv_134, the subject of a tea-leaf-reading thread.

Slides and Code Samples on Jersey and JAX-RS
The Slides and code from Paul Sandoz's presentation at Presentation at AlpesJug on Jersey, JAX-RS and Atmosphere are now  …

[Read more]
How to get colored output from ‘ls’ on Solaris10

For all of those linux users out there that have moved over to, or tried out, Solaris10 or OpenSolaris because they heard the tales of how MySQL is faster on Solaris… or perhaps you wanted to learn how to use Sol10 for the great features of Zones or the ZFS filesystem? Regardless of why you’re on it you are probably wondering why Linux has colored output of filenames and directories but Solaris does not. The question of ‘why?’ isn’t important, but how to enable colors is. It’s very simple, and here’s how I fixed it. This is a result of digging through multiple semi-related links on Google.

  1. Download all packages from SunFreeware.com
    • dependency: libintl-3.4.0-sol10-x86-local
    • dependency: libiconv-1.13.1-sol10-x86-local
    • dependency: gmp-4.2.1-sol10-x86-local
    • dependency: gcc-3.4.6-sol10-x86-local or libgcc-3.4.6-sol10-x86-local depending on your …
[Read more]
Save time and energy: How to …

Save time and energy: How to:

Listening to “Highway to Hell” in an Oxford University computer lab on a sunday afternoon writing a MySQL blog can be legitimally defined by some as sick but thats what a geek calls a relaxing yet productive sunday afternoon.

For the sake of all those CLI ambassadors like myself, I wanted to share a couple of tips and tricks I use quite often when doing my mysql db administration work / scripting. I strongly suggest any mysql dba / dev use CLI simply because thats the one thing you should always have on any machine on which mysql is installed, be it Unix, Linux, Mac, Microsoft or whatever platform you are using.

Cancelling a query you are typing without exiting to the terminal:
`\c` – How many times you ended up hitting `CTRL+C` (default process kill in most OSes) in order to cancel a command, finding yourself going back to the console and having to connect again? Nuisence? Hell …

[Read more]
Showing entries 11 to 17
« 10 Newer Entries