Tips for Interacting with mysql

This section discusses how to interact with the mysql client program more efficiently and with less typing. It describes how to connect to the server more easily and how to enter queries without typing each one from scratch.

Simplifying the Connection Process

It's likely that you need to specify connection parameters such as hostname, username, or password when you invoke mysql. That's a lot of typing just to run a program, and it gets tiresome very quickly. There are several ways to make it easier to connect by minimizing the amount of typing you do:

  • Use an option file to store connection parameters.

  • Repeat commands by taking advantage of your shell's command history capabilities.

  • Define a mysql command line shortcut ...

Get MySQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.