MySQL Forums
Forum List  »  Newbie

Re: 'mysql -h localhost -u root -p' shortcut??
Posted by: Felix Geerinckx
Date: July 28, 2005 08:41AM

mamma.san wrote:
> A strange qustion, but i was wondering if there was a quick way to log into mysql in terminal on
> OS X without having to type mysql -h localhost -u root -p everytime. This is purely for time saving
> reasons, and I'm sure you might think 'why doesn't he just type it?' but I'm curious.

Why aren't you just typing it in?
Seriously, if you create a .my.cnf file in root's home directory with the following content:

[mysql]
user=root
password=root's password
host=localhost

all you have to type is mysql (at least that's how it works on Linux).
If you leave out the password, you must type mysql -p.
(You decide whether 3 keystrokes less is worth the security risk ;)

--
felix
Please use BBCode to format your messages in this forum.

Options: ReplyQuote


Subject
Written By
Posted
Re: 'mysql -h localhost -u root -p' shortcut??
July 28, 2005 08:41AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.