使用python代码 <?php $link=mysql_connect('192.168.100.10','phptest','123456'); if($link) echo "Successfuly"; else echo "Faile"; mysql_close(); ?>
时间: 2023-05-26 16:07:35 浏览: 148
import mysql.connector
config = {
'user': 'phptest',
'password': '123456',
'host': '192.168.100.10',
'database': 'your_database_name'
}
try:
cnx = mysql.connector.connect(**config)
print("Successfully connected")
except mysql.connector.Error as err:
print(f"Error: {err}")
finally:
cnx.close()
阅读全文