logging into mysql using the command line

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
noguru
Forum Commoner
Posts: 61
Joined: Thu Jun 06, 2002 4:03 am
Location: Just north of the City Of Gold, Land of Milk and Honey

logging into mysql using the command line

Post by noguru »

Hi

Up to now I've used a webinterface which someone wrote before me, to work on my database, but now there is a problem with this interface and I need to get into my database using an alternative way, such as the SSH command line.

Can anyone tell me how to login to mysql using the command line? I know it should be something like "mysql -parameters such as hostname, database, username and password" , but nothing seems to work.

Thank you
Tzicha
Forum Newbie
Posts: 8
Joined: Wed Sep 04, 2002 9:54 am

Post by Tzicha »

To login to a remote host:
mysql -h <host> -u <user> -p

Not supplying the password after the -p flag will prompt you to type it, that way it doesn't appear in ps ax listings. If MySQL is running on the localhost:
mysql -u <user> -p
User avatar
noguru
Forum Commoner
Posts: 61
Joined: Thu Jun 06, 2002 4:03 am
Location: Just north of the City Of Gold, Land of Milk and Honey

Post by noguru »

thnx tzicha!
Post Reply