Advertisement
Guest User

Untitled

a guest
Mar 6th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. import mysql.connector
  2.  
  3. n_mysql_server = "MLAB-01-NIM01";
  4. n_mysql_user = "root";
  5. n_mysql_pass = "nim2014";
  6. n_mysql_db_name = "n_proj";
  7.  
  8. cnx = mysql.connector.connect(user=n_mysql_user, host=n_mysql_server, password=n_mysql_pass, database=n_mysql_db_name)
  9. cursor = cnx.cursor()
  10.  
  11. query = ("SELECT * FROM assets")
  12.  
  13. cursor.execute(query)
  14.  
  15. for first_name in cursor:
  16. print("{}".format(first_name))
  17. cursor.close()
  18. cnx.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement