Fetching data from MySQL database using python

Hello friends, in this post, we will see, fetching data from MySQL database using python. For this post, we will be needing a machine having MySQL installed in it. You can either download XAMPP for windows or LAMPP for Linux or even install separately. Now once done, we need to know the MySQL host of the machine, in which it is installed. Now, to find MySQL Host,

  • For XAMPP as well as LAMPP, it is localhost, by default.
  • For manual installs, open MySQL console, and type select user(); 
Cool, we are done with installing the pythonic libraries for the MySQL Database, now let us see, how to setup a connection between python program and your MySQL host.
This is how we will be connecting the database with a python program, hope you enjoyed reading this post. Share this with your friends and help us grow. If you got any queries, then drop them in the comments below.

Hey there, I’m Sid. I often write articles here. Apart from being a developer, my interest range from blogging, designing, tinkering and hearing electronic. To connect with me, just navigate to any social icons, below!

Sidharth Patnaik

Hey there, I'm Sid. I often write articles here. Apart from being a developer, my interest range from blogging, designing, tinkering and hearing electronic. To connect with me, just navigate to any social icons, below!

2 thoughts on “Fetching data from MySQL database using python

  • September 24, 2017 at 6:20 pm
    Permalink

    Thankyou sir
    But what about if we want to connect to a central server database? Is it possible?
    Can we also use SQLite database in the similar way? Is SQLite meant only for storing data in the same device, or can we handle global database access?

    Reply
    • October 14, 2017 at 5:03 pm
      Permalink

      Hey Rahul, you can use https://db4free.net/ for remote access of your MySQL database. It is free service. Regarding SQLite, i wouldn’t recommend using it, because its not meant for high volume data storage. Thanks 😉

      Reply

Leave a Reply

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