How to Mysql Setup?
Dom Jan 21, 2018 2:24 pm
I have 1.419 resource files. I want to convert it to Sqlite3 Mysql. How can I do it.
I do the Atelier801 Forum. which I will share the file if you help me.
I do the Atelier801 Forum. which I will share the file if you help me.
- Forsak3nn
BANIDO - Mensagens : 57
Data de inscrição : 16/01/2018
Idade : 24
Re: How to Mysql Setup?
Dom Jan 21, 2018 3:30 pm
Normal db yi bağlamayı denedin mi
Re: How to Mysql Setup?
Dom Jan 21, 2018 6:01 pm
Normal DB mysql bağlantı kodunu atabilirmisin?Forsak3nn escreveu:Normal db yi bağlamayı denedin mi
Re: How to Mysql Setup?
Dom Jan 21, 2018 6:18 pm
Você deseja fazer a configuração para MySQL ou SQLite?
Bom, se caso for mysql, instale o módulo MySQLdb, importe no início do código e acima da class client adicione:
E em if __name__ == "__main__" coloque:
Depois crie o arquivo connect.json e adicione:
Lembre-se de efetuar as devidas mudanças nas Querys, deve trocar de '?' para '%s'.
Bom, se caso for mysql, instale o módulo MySQLdb, importe no início do código e acima da class client adicione:
- Código:
def getMysqlConnect(mysql):
if os.path.exists("./include/mysql/connect.json"):
with open("./include/mysql/connect.json", "rb") as ConnectMysql:
MysqlList = ConnectMysql.read()
try:
Myconf = json.loads(MysqlList)
return Myconf[mysql]
except:
return {}
E em if __name__ == "__main__" coloque:
- Código:
# Connection MySQL Database
Database, Cursor = None, None
try:
Database = MySQLdb.connect(host=str(getMysqlConnect('Host')),user=str(getMysqlConnect('User')),passwd=str(getMysqlConnect('Pass')),db=str(getMysqlConnect('DB')),port=int(getMysqlConnect('PORT')))
Cursor = Database.cursor()
except MySQLdb.Error, e:
print "\n"
print e
Depois crie o arquivo connect.json e adicione:
- Código:
{
"Host" : "localhost",
"User" : "root",
"Pass" : "password",
"DB" : "nome_do_banco",
"PORT" : 3306,
}
Lembre-se de efetuar as devidas mudanças nas Querys, deve trocar de '?' para '%s'.
Re: How to Mysql Setup?
Dom Jan 21, 2018 6:42 pm
Danshweger escreveu:Você deseja fazer a configuração para MySQL ou SQLite?
Bom, se caso for mysql, instale o módulo MySQLdb, importe no início do código e acima da class client adicione:
- Código:
def getMysqlConnect(mysql):
if os.path.exists("./include/mysql/connect.json"):
with open("./include/mysql/connect.json", "rb") as ConnectMysql:
MysqlList = ConnectMysql.read()
try:
Myconf = json.loads(MysqlList)
return Myconf[mysql]
except:
return {}
E em if __name__ == "__main__" coloque:
- Código:
# Connection MySQL Database
Database, Cursor = None, None
try:
Database = MySQLdb.connect(host=str(getMysqlConnect('Host')),user=str(getMysqlConnect('User')),passwd=str(getMysqlConnect('Pass')),db=str(getMysqlConnect('DB')),port=int(getMysqlConnect('PORT')))
Cursor = Database.cursor()
except MySQLdb.Error, e:
print "\n"
print e
Depois crie o arquivo connect.json e adicione:
- Código:
{
"Host" : "localhost",
"User" : "root",
"Pass" : "password",
"DB" : "nome_do_banco",
"PORT" : 3306,
}
Lembre-se de efetuar as devidas mudanças nas Querys, deve trocar de '?' para '%s'.
What is error?
Re: How to Mysql Setup?
Dom Jan 21, 2018 6:46 pm
Try again and delete def getMysqlConnect/connect.json
Put the configs here:
Put the configs here:
- Código:
Database = MySQLdb.connect(host='',user='',passwd='',db='',port='')
Re: How to Mysql Setup?
Dom Jan 21, 2018 6:50 pm
Danshweger escreveu:Try again and delete def getMysqlConnect/connect.json
Put the configs here:
- Código:
Database = MySQLdb.connect(host='',user='',passwd='',db='',port='')
Re: How to Mysql Setup?
Dom Jan 21, 2018 7:01 pm
jacksparroww escreveu:Danshweger escreveu:Try again and delete def getMysqlConnect/connect.json
Put the configs here:
- Código:
Database = MySQLdb.connect(host='',user='',passwd='',db='',port='')
the port is port=3306, without ''
Re: How to Mysql Setup?
Dom Jan 21, 2018 7:07 pm
jacksparroww escreveu:
""
Send me teamviewer id on private message
Permissões neste sub-fórum
Não podes responder a tópicos
|
|