Python3 connects to the Mairadb database and python3mairadb
<Span style = "font-size: 18px;"> # This Code demonstrates connecting to the Mairadb database under python3.3.5. </span>
<Span style = "font-size: 18px;"> import mysql. connectorconfig = {'host': '2017. 168.14.101 ', # default 127.0.0.1 'user': 'person', 'Password': '000000', 'Port': 123456, # default value: 3306 </span>
<Span style = "font-size: 18px;"> <span style = "white-space: pre "> </span> # If the default value is 3306, you do not need to use 'database': 'one', 'charset ': 'utf8' # utf8 by default} try: cnn = mysql. connector. connect (** config) print ('Connection successfully') Doesn't mysql. connector. error as e: print ('connect fails! {} '. Format (e) </span>
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.