1.python连接mysql8.0数据库importpandasasppdfromsqlalchemyimportcreate_engineengine=create_engine('mysql+mysqlconnector://root:123456@loc??alhost:3306/ssm')sql='select*fromteacher;'df=pd.read_sql_query(sql,engine)print(df)2.R连接mysql8.0数据库(自己配置ODBC)library(RODBC)channel<-odbcConnect("RMySQL",uid="root",pwd="123456")crimedat<-sqlQuery(channel,"select*fromteacher")print(crimedat)3.python连接到mongodb4.2数据库(我没有passwordformongo)frompymongoimportMongoClientconnect=MongoClient('mongodb://localhost:27017/')db=connect['analysis']collection=db['student']collection.find_one()4.R连接到mongodb4。2数据库(我没有mongo的密码)library(mongolite)con<-mongo(collection="student",db="analysis",url="mongodb://localhost")con$find()
