How to Access MySQL Command Line in XAMPP?

Posted on February 4, 2012. Filed under: mysql, xampp |

MySQL binaries should be under your XAMPP folder. Look for a /bin folder, and you’ll find the mysql.exe client around. Let’s assume it is in e:\xampp\mysql\bin, then you should fireup a command prompt in this folder.
First, go to e:\xampp, and run xampp_start. If you do not run xampp_start first, the error message “Can’t connect to Mysql server on ‘localhost’” will occur when you go to step 2.
Afer you run the commend prompt of DOS, then enter:
cd d:\xampp\mysql\bin
mysql.exe -u root –password
Enter password:
and enter root password
mysql>
After log into your mysql server, and start typing your commands.
Type “quit”  or “exit” to exit mysql

If you forgot mysql root password, what to do then? You can change root password as follows:
1. Stop running mysql;
2. Creat a .txt file, say “newrootpassword.txt”, enter the content:
SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘MyNewPassword’);
Save the file under F:
3. Run DOS commnad prompt  line:
C:\> F:\mysql\bin\mysqld-nt –init-file=F:\newrootpassword.txt
4. Run mysql, and stop it. Your new myslq root password will be OK.

Make a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Liked it here?
Why not try sites on the blogroll...

%d bloggers like this: