Working with MySql on XAMPP

Getting my hands dirty into some programming stuff. I have some networking background with zero programming knowledge. Was reading some article on hacking and Sql injection and was interesting in how these stuffs work.

Thought of trying my hands in programming… Installed PHP and XAMPP in my laptop and trying to get started with Web development programming.

Was working on getting some html pages created with forms getting user inputs using GET/POST and get it saved somewhere. The book I was following suggested to go through the basic SQL command that will help in understanding how things works.

So here I am trying to work with the MySql installed as a service by XAMPP.

The first question comes to my mind how to connect to the MySql server ?

When you install the XAMPP installer it creates a XAMPP control panel as a shortcut on the desktop when you start this, it looks like following with control of starting and stopping the services.

You see that I have the Apache and the MySql services are running. When you click on the Admin tab it takes you to the WebUI of the MySql server, or you can also access it using the following url on the web-browser :

http://localhost/phpmyadmin/

Following is the page you will get.. next it is to explore the various options. I am using an older version of XAMPP so the newer version might have a different look of the page.

You might be presented with a login page before this , the default user created is : root without any password. Use the username : root and hit login.

Also lets try to login to the server using the cmd prompt.

The XAMPP is by default installed in the c:\xampp directory. Goto the following directory : c:\xampp\mysql\bin>

Now login using the command: mysql –user==root.  // This will log you in as a root user.

 

In case you have created any username and password using the GUI and want to login using those credential use the command:

mysql –user=<username> –password=<password> <DB you want to connect to>

c:\xampp\mysql\bin>mysql –user=root

Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 297
Server version: 5.5.8 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql>

 

In my case I had created a username Ramesh password Ramesh and DB ramesh from the WebUI, now I would login using the command line:

c:\xampp\mysql\bin>mysql –user=Ramesh –password=Ramesh ramesh

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 193
Server version: 5.5.8 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

I can view my DB now :

mysql> select * from shopping
-> ;

+——–+————-+———————-+———-+————–+——-
—–+——–+——————+—–+———————–+

| Name   | Customer ID | Address              | Address1 | Work Phone   | Home P

hone | Status | Job              | Age | Note                  |

+——–+————-+———————-+———-+————–+——-
—–+——–+——————+—–+———————–+

 

Now its time to get started with some Sql queries.

You can download XAMPP from the following link:

 

http://sourceforge.net/projects/xampp/

 

 

Hope this was helpful….

One thought on “Working with MySql on XAMPP

Leave a Reply

Your email address will not be published. Required fields are marked *