title: Create a mysql database using python tkinter
body: <p>I am creating a GUI for all database queries such as to create database, create table and insert record into table. But I am stuck in creating database as I want that all values like : host name, username, password and database name should be enter on gui window.</p>
  <p>I tried this code</p>
  <pre><code>import numpy as np
  from tkinter import *
  from tkinter.filedialog import askopenfile
  import importlib
  import os
  import tkinter
  import mysql.connector as msql
  from mysql.connector import Error
  import pandas as pd
  
  root = Tk() 
  root.geometry(&quot;500x500&quot;)
  root.config(bg=&quot;light gray&quot;)
  
  # declaring string variable 
  host_var = StringVar()
  user_var = StringVar()
  pass_var = StringVar()
  db_name = StringVar()
  
  
  def Submit_db():
      host = host_var.get()
      user = user_var.get()
      pas = pass_var.get()
      db = db_name.get()
      
      print(&quot;Host name is&quot;+host)
      print(&quot;user name is&quot;+user)
      print(&quot;pass name is&quot;+pas)
      print(&quot;db name is&quot;+db)
  
      try:
          conn = msql.connect(host=host, user=user,  password=pas)
          if conn.is_connected():
              cursor = conn.cursor()
              cursor.execute(&quot;CREATE DATABASE &quot;+ db)
              print(db+&quot;database is created&quot;)
      except Error as e:
          print(&quot;Error while connecting to MySQL&quot;, e)
          
  def create_db():
      root_db=Tk()
      root_db.geometry(&quot;350x350&quot;)
      
      Label(root_db,text=&quot;Host&quot;).grid(row=0,column=1)
      entry1= Entry(root_db,textvariable = host_var).grid(row=0,column=2)
      
      Label(root_db,text=&quot;User&quot;).grid(row=1,column=1)
      entry2 = Entry(root_db, textvariable = user_var).grid(row=1,column=2)
      
      Label(root_db,text=&quot;Password&quot;).grid(row=2,column=1)
      entry3 = Entry(root_db,textvariable= pass_var, show=&quot;*&quot;).grid(row=2,column=2)
      
      Label(root_db, text = &quot;Database Name&quot;).grid(row=3,column=1)
      entry4 = Entry(root_db, textvariable= db_name).grid(row=3,column=2)
          
      Button(root_db, text= &quot;Submit&quot;,command=Submit_db).grid(row=4,column=1)
  
      root_db.mainloop()
  
  
  label1 = Label(root, text=&quot;Select your choice&quot;, font=&quot;bold&quot;)
  label1.grid(row=0,column=1)
  
  db_button = Button(root,text=&quot;Create database &quot;,command=create_db)
  db_button.grid(row=2,column=1)
  
  table_botton = Button(root,text=&quot;Create table&quot;,font=&quot;bold&quot;).grid(row=2,column=2)
  
  record_table=Button(root,text=&quot;Insert record&quot;,font=&quot;bold&quot;).grid(row=2,column=3)
  
  root.mainloop() 
  </code></pre>
  <p>but it gives the error:</p>
  <pre><code>Host name is
  user name is
  pass name is
  db name is
  Error while connecting to MySQL 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)
  </code></pre>
  <p>It looks like it does not took the values from the entry window as print function returns nothing. I may be make mistake in <em>submit</em> button. But i have no idea how to connect them with each other to get it worked.</p>