MySQL command line

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

MySQL command line

Postby Perad » 19. August 2008 13:18

I have installed XAMPP on my Mac. It is working great! However I have a 80MB SQL file that I need to upload.

Could someone talk me through how I do this?

All I need is the simple steps.

How to connect to mysql
How to authenticate
How to send the file.

Help with this is very much appreciated.
Perad
 
Posts: 14
Joined: 19. August 2008 13:15

Postby Nobbie » 19. August 2008 13:50

Look for "mysql" Command Line Tool (*should* be in the same folder as the other tools, like mysqld - the server - etc.pp.) and enter the following command in a shell:

Code: Select all
mysql --user=user --password=password database <filename.sql


where "user" and "password" is a valid MySQL User and Password, database is a valid databasename and filename.sql is your SQL File.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Postby Perad » 19. August 2008 16:13

I can't find it. Do you know what the file is called?

All I have done is added files to the htdocs folder. I haven't made any changes to the files or file structure. With this in mind could you tell me the path to where it should be?
Perad
 
Posts: 14
Joined: 19. August 2008 13:15

Postby Perad » 20. August 2008 11:22

I still can't work out how I access the mysql terminal. Could someone help out please.
Perad
 
Posts: 14
Joined: 19. August 2008 13:15

Postby Perad » 20. August 2008 11:51

I think this is right. I have navigated to /Applications/xxampp/xampfiles/bin

In this folder there is a unix executable file called 'mysql'

Unfortunately I cannot work out how to access this. If I type in the command above it comes up with

-bash: mysql: command not found




If I double click it the terminal opens and says the following.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/Applications/xampp/xamppfiles/var/mysql/mysql.sock' (2)
logout

[Process completed]
Perad
 
Posts: 14
Joined: 19. August 2008 13:15

Postby Perad » 20. August 2008 12:09

Sorry for the recent stream of updates I have the console working now. However I am now stuck. It is eating my commands but noting is happening.

/Applications/xxampp/xampfiles/bin/mysql is the file I am double clicking to launch the console.

My User/Pass are root/blank

Could someone help me upload this file.

No matter what I put into the terminal it is eating my commands. For example.

mysql> mysql --user=root --password= database </Users/jasonstanley/Desktop/database.sql
->


There are no confirmations. I'm confused.

Am I on the right thing? If so could someone tell me what I am doing wrong.
Perad
 
Posts: 14
Joined: 19. August 2008 13:15

Postby Nobbie » 20. August 2008 12:24

>Applications/xxampp/xampfiles/bin/mysql is the file I am double clicking to launch the console.

This is wrong and it is *not* what i told you.

You have to open a shell (a console) and change directory to
/Applications/xxampp/xampfiles/bin.

There you must enter this command (obiously you have to prefex mysql with the current folder './' as your user does not look in current folder for executables - thats what the error message "-bash: mysql: command not found" means!):

Code: Select all
./mysql --user=user --password=password database <filename.sql
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Postby Perad » 20. August 2008 14:05

Nobbie wrote:(obiously you have to prefex mysql with the current folder './' as your user does not look in current folder for executables - thats what the error message "-bash: mysql: command not found" means!)


*sigh*

As someone who knows nothing about consoles that was not so obvious.

The file is now being executed without issues. 8)

Thanks for your for your time and patience
Perad
 
Posts: 14
Joined: 19. August 2008 13:15

Re: MySQL command line

Postby some1likeu » 28. May 2012 12:11

My database doesn't have password, I use this line of command: -u root -p
But it thrown an error
Any one could help me?
Many thanks!
some1likeu
 
Posts: 1
Joined: 28. May 2012 11:47
Operating System: Windows

Re: MySQL command line

Postby JonB » 29. May 2012 13:08

I'm confused:

Are you on a Mac or a Windows machine?

Source of Confusion:
XAMPP Version: 1.7.4
Operating System: Windows

:?:
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

Re: MySQL command line

Postby Altrea » 29. May 2012 18:31

Maybe he is using the brand new AppleSoft Win OS X(P) :lol:
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64


Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 21 guests