Friday 6 December 2013

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/

Labels:

3 Comments:

At 20 January 2021 at 09:44 , Blogger Anil IT Expert said...

Nice stuff, it was nice to see this article about Xampp. It was really appreciable. Thank you so much for sharing such an informative article about - how to change port number in xampp server

 
At 4 May 2021 at 05:52 , Blogger hema said...

Great Post with valuable info. Thank you for the updates.

Learn Dot NET Online
dot net certification course online

 
At 25 May 2021 at 07:32 , Blogger nayar said...


Get inspired by your blog. Keep doing like this....
Spoken English Classes in Bangalore
Spoken English Classes in Pune
spoken english centre in Hyderabad
English Speaking Course in Gurgaon

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home