Skip to main content

Posts

Showing posts with the label mysql

How to Connect Python with MySQL Database

  How to Connect Python with MySQL Database T oday, We will learn on how to connect Python with Mysql. This tutorial will let you know how python can be used with database applications. Before starting with our tutorial, we need to have MySQL installed in your System. You can download the MySQL database form   https://www.mysql.com/downloads/ In order to connect with MySQL, Python requires Mysql Driver. So, as the next step towards database connectivity we can now install MySQL Driver. Open Command Prompt or terminal and type the following commands. We will be using PIP for faster and safer installation of the packages.  Command to Install MySQL Connector python - m pip install mysql - connector Now, we have done installing Mysql Connector. Our next process is to test the installation. Let's do that by simply importing the mysql connector package. import mysql . connector If the above import statement did not produce any errors or warnings, then hurrah! we've successfull...

How to Connect SQLite With Python - Step By Step Guide

  How to Connect SQLite With Python - Step By Step Guide In this tutorial, we will be learning about SQLite database and how to connect it with python for the development of database applications. SQLite as the name says, it's a simple, single file database. There is no need of downloading and installing additional files. SQLite comes packed with most python installations. From version 2.5.x onward the SQLite module comes along as a default module. Importing SQLite Module: import sqlite3 Creating a database in SQLite is very simple as if we create a a directory or a file. Database in SQLite is created during the connection phase. Database will be stored as a file in the specified directory.  Now, let's connect to our database: Create a Database and make a connection: import sqlite3 con = sqlite3 . connect ( 'mydata.db' ) From the above code block, we can see that, the connect method is provided with a parameter  'mydata.db' .  This is what our database name is...

How to Connect PHP to MySQL Database?

  How to Connect PHP to MySQL Database? In this tutorial we will be learning about how to connect to MySQL Database Management System with PHP. Some Points on MySQL MySQL uses Standard SQL MySQL is free to download MySQL is best suitable for Small and Large Applications Some Points on PHP PHP is a server scripting language PHP scripts are executed in server and pure HTML is returned back to client. PHP files have extension  .php PHP is easy to Learn and implement PHP supports both Structural Programming Paradigm and Object Oriented Programming Paradigm. 1. First, Let's create a Database in MySQL CREATE DATABASE TestDB ; 2. Let's create a Table in TestDB CREATE TABLE testTABLE ( id INT , Fname VARCHAR ( 50 ) , Lname VARCHAR ( 50 ) , EmailID VARCHAR ( 120 ) ) ; 3. Let's Connect to TestDB $mysql_host = "localhost" ; //host address may vary. ex : localhost:3302 $mysql_user = "root" ; //Given by your hosting provider $mysql_pass = ...