Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import MySQLdb
- connection = MySQLdb.connect(
- host = 'localhost',
- user = 'root',
- passwd = 'admin') # create the connection
- cursor = connection.cursor() # get the cursor
- print("1. wyswietl baze")
- wybor = raw_input("wybierz opcje: ")
- if wybor=="1": #print("wybrales wybor bazy")
- cursor.execute("SHOW DATABASES")
- connection.commit()
- numrows = int(cursor.rowcount)
- for x in range(0,numrows):
- row = cursor.fetchone()
- print row[0]
- #cursor.execute("USE mysql") # select the database
- #cursor.execute("SHOW TABLES") # execute 'SHOW TABLES' (but data is not returned)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement