How to access MySQL command line?

Problems with the Windows version of XAMPP, questions, comments, and anything related.

How to access MySQL command line?

Postby Galdhrim » 08. August 2008 18:16

How can I access the mysql console? I have tried from windows command prompt, but it refuses to let me in...
Galdhrim
 
Posts: 35
Joined: 28. March 2008 05:20

Postby Nobbie » 08. August 2008 21:36

What did you try exactly?
Nobbie
 
Posts: 8780
Joined: 09. March 2008 13:04

Postby Galdhrim » 11. August 2008 08:25

I don't remember details now, I had posted this question in a thread, and that was several days ago...

But I went to windows XP command console, and tried something like:

"mysql.exe -user pass" or something like that. Please note that I don't remember now the name of the exe file, and I don't remember the options I tried to use. At first, I tried without providing a password, and it said "wrong password". When I provided a password, it said something like "refused connection"... I looked at the commands provided by -help option (or maybe it was /option or -h... I really can't remember that now), but I couldn't discover the right way to do it.

I was used to be asked for my password and nothing more, when I used WampServer...
Galdhrim
 
Posts: 35
Joined: 28. March 2008 05:20

Postby Nobbie » 11. August 2008 11:57

To enter the command line mode you must enter this command in a cmd:

Code: Select all
mysql --user=username --password=passwd database


where "username" is a valid MySQL User, "passwd" is the password of "username" and "database" is a valid Database in MySQL.

If you like to connect to a server different from the localhost, you may also apply a different host:

Code: Select all
mysql --user=username --password=passwd --host=hostname database
Nobbie
 
Posts: 8780
Joined: 09. March 2008 13:04

Postby Galdhrim » 11. August 2008 16:12

Nobbie wrote:To enter the command line mode you must enter this command in a cmd:

Code: Select all
mysql --user=username --password=passwd database


where "username" is a valid MySQL User, "passwd" is the password of "username" and "database" is a valid Database in MySQL.



I see... my mistake was to not use the --password= option... now I remember I provided the user in the right way, but I just put a blank space an my password... also, I didn't enter the name of the database. In Wampserver, I had to login first, and the use the "use" command to enter the database name...

Thanks for your reply, I intend to keep using Xampp (because of the portability of non-install version, it can run in not default ports, and it has a lot of interesting addons), so being able to use mysql command line mode is really important.

Thanks again.
Galdhrim
 
Posts: 35
Joined: 28. March 2008 05:20

Postby Nobbie » 11. August 2008 21:38

>In Wampserver, I had to login first, and the use the "use" command to enter the database name...

This works also, you need not to specify a database name on the command line (it's optional). I simply recommend it for ease of use.
Nobbie
 
Posts: 8780
Joined: 09. March 2008 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 60 guests