hello i was trying to connect by string or variable first but it didnt seem to hold.
i have checked multiple forums and did lots of google but i dont seem to figure it out please help me in mij proces
i have checked multiple forums and did lots of google but i dont seem to figure it out please help me in mij proces
import MySQLdb from concurrent.futures import ThreadPoolExecutor import os, sys inp = open('database-sorted.txt', 'r', encoding='utf-8') content_list = [line.rstrip('\n') for line in inp] print(inp) connection = eval('MySQLdb.connect({})'.format(inp.readlines().strip())) inp.close() print (connection)a second way i did try was this god even with str and +str(blabla)+
build = '\nDB_HOST: '+str(db_host)+'\ndb_database: '+str(db_database)+'\nDB_USERNAME: '+str(db_username)+'\nDB_PASSWORD: '+str(db_password) remover = str(build).replace('\r', '') save = open('Results/blblbl.txt', 'a') save.write(remover+'\n\n') save.close() cnx = mysql.connector.connect(user='{db_user}', password='{db_password}', host='{db_host}', database='{db_database}') except mysql.connector.Error as err: if err.errno == errorcode.ER_ACCESS_DENIED_ERROR: print("Something is wrong with your user name or password") elif err.errno == errorcode.ER_BAD_DB_ERROR: print("Database does not exist") else: print(err) else: print("You are connected!") cnx.close()
Larz60+ write Mar-23-2021, 12:21 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.