Or XLMPP for that matter 😉
There are two ways to do it. Both are basically the same, but one just makes it a lot easier. We’ll go over the harder one first.
First Method:
Start the command prompt, and cd to the xampp directory. It’ll usually be something like:
cd ../../Program Files/xampp
if you used the installer and default install location.
Once in there, cd to the mysql bin directory.
cd mysql/bin
Now, run the command:
mysql.exe --user=root --password=
And the MySQL command line will start. If you’ve changed the username or password of the MySQL user, you need to change the –user= and –password= accordingly.
Second method:
Basically the same way as before, but we’ll create a batch file to make it easier.
First, create a file called mysql_command.bat
in the XAMPP directory.
Edit this file with Notepad or any text editor, and paste in this:
@echo off echo Starting MySQL command line... mysql\bin\mysql.exe --user=root --password= pause
Save it, and change the –user= and –password= if you’ve changed the user or password.
Now, run mysql_command.bat and a command prompt will show up with the MySQL command line running.
It’s as easy as that.
Thankyou so so much. I have spent all day trying to work this out. I’m absolutely rapped by the above information.
Bianca
thanks for sharing!
Yes thank you, but you can also but the path to mysql.exe to your path variable start>settings>system>advanced>environmentvariables>system variable>path>edit and then add
c:\pathToYourXampp\mysql\bin;
to the end or the beginning of the string
then click ok and ok.
if you now start a new shell you may type “mysql -u yourUsername -p yourPassword(optional)”
greets LeCross
Tnx a lot!!
Hey, this is great information, thanks. I just used it to help a friend who was stuck trying to work out how to get to the mysql command line in XAMPP (which I don’t use myself).
You might like to know that this information has been reposted on another blog, too:
http://prajapatinilesh.wordpress.com/2008/01/21/access-mysql-command-line-in-xamppxlmpp/
Thanks, it helps me alot 🙂
I’ve got a 64 bit processor and it says mysql.exe isn’t a valid win32 application. Is there another way of launching this in 64 bit mode or is there a 64-bit compiled version?
thanx for the info! very useful article!
Great info…
Thanks
Thanks a bunch!! Both solutions worked and I shall, of course, use the bat file on a routine basis.
Thanks a mil-I’ve been trying to follow along in a few MySQL books and they show the command line syntax only-thanks for your help!
Very helpful
mysql -? |more gives some more options such as:
mysql -h remotehostname
Thanks a lot for your information!Great help!!!
Both solutions do for me!
Nice to know your site too 😀
Thanks a million. Was looking hi and low for this information.
tks a heap for the tips!
Thank you very much keep posting such things it really helps…
This is cool. Thanx 🙂
thank you so much much!
Hey thank u very much..that really works..great…was desperately looking for a good explanation…keep going…
Can’t thank you enough. Spent hours trying to find this answer. You solved it for me in seconds.
thank you a lot James… Now i can practice MySQL codes
merci beaucoup
thanks alot!
Triffic…
Thanks for this, really helped me out!
thanks, it was very helpful!
THANKS SO MUCH!
error 1045 coming… if i enter password thn olso n if i dun enter password then olso..wat to do..?/
Awesome jus what I needed
yes the batch file works
Thanks a lot sir 😀
You can also add the path to the mysql.exe in your environment variables, that way windows CMD will recogniza the command “mysql”. just copy the path to the mysql/bin folder to the PATH environment variable of your PC and thats it
thank you:)
Thank you was very useful and easy
thanks a million . . . 🙂