MySQL command line

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

MySQL command line

Postby true2self » 07. June 2012 21:07

Okay, i'm fairly new to my Mac and never really use command line for mysql until now. I always used a monitoring tool, but since the db i'm using is massive I must use the command line so it won't time out. So here is my so basic question...

How do I connect to localhost via the terminal?

I go to the xampp bin folder and open up the mysql exec file and type in "show databases;" I only see 2. I know I have at least 10 that I created (via mql workbench) and currently use on localhost. So, my question is, how do I get there to see them?
true2self
 
Posts: 4
Joined: 06. June 2012 19:09
Operating System: OSX

Re: MySQL command line

Postby true2self » 07. June 2012 22:11

okay. so I solved this one with a little help from a friend. If beginners needs to know...

First I opened a basic terminal

Code: Select all
cd /Applications/XAMPP/xamppfiles/bin

Code: Select all
./mysql -u root -p -h localhost db_name < /Users/work/Desktop/filename.mysql


This was a script used to populate the schema, hence the .mysql extension i'm assuming. I'm sure this will work with importing a database as well.

to connect to see the database on localhost

Code: Select all
./mysql -u root -p -h localhost

Code: Select all
show databases;
true2self
 
Posts: 4
Joined: 06. June 2012 19:09
Operating System: OSX

Re: MySQL command line

Postby JonB » 08. June 2012 13:58

Thanks for the tip.

Here's something to add to your toolkit:

http://www.mysql.com/products/workbench/

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 11 guests