本文整理汇总了Python中mysqlconf.MySQL.execute方法的典型用法代码示例。如果您正苦于以下问题:Python MySQL.execute方法的具体用法?Python MySQL.execute怎么用?Python MySQL.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysqlconf.MySQL
的用法示例。
在下文中一共展示了MySQL.execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Dialog
# 需要导入模块: from mysqlconf import MySQL [as 别名]
# 或者: from mysqlconf.MySQL import execute [as 别名]
elif opt == '--email':
email = val
if not password:
d = Dialog('TurnKey Linux - First boot configuration')
password = d.get_password(
"b2evolution Password",
"Enter new password for the b2evolution 'admin' account.")
if not email:
if 'd' not in locals():
d = Dialog('TurnKey Linux - First boot configuration')
email = d.get_email(
"b2evolution Email",
"Enter email address for the b2evolution 'admin' account.",
"[email protected]")
inithooks_cache.write('APP_EMAIL', email)
hash = hashlib.md5(password).hexdigest()
m = MySQL()
for username in ('admin', 'ablogger', 'demouser'):
m.execute('UPDATE b2evolution.users SET user_pass=\"%s\", user_email=\"%s\", user_unsubscribe_key=\"%s\" WHERE user_login=\"%s\";' % (hash, email, randomkey(), username))
if __name__ == "__main__":
main()
示例2: Dialog
# 需要导入模块: from mysqlconf import MySQL [as 别名]
# 或者: from mysqlconf.MySQL import execute [as 别名]
email = val
if not password:
d = Dialog('TurnKey Linux - First boot configuration')
password = d.get_password(
"Zoneminder Password",
"Enter new password for the Zoneminder 'admin' account.")
if not email:
if 'd' not in locals():
d = Dialog('TurnKey Linux - First boot configuration')
email = d.get_email(
"Zoneminder Email",
"Enter email address for the Zoneminder alerts.",
"[email protected]")
inithooks_cache.write('APP_EMAIL', email)
m = MySQL()
hash=m.execute('')
m.execute('UPDATE zm.Users SET Password=PASSWORD(\"%s\") WHERE Username=\"admin\";' % password )
m.execute('UPDATE zm.Config SET Value=\"%s\" WHERE Name=\"ZM_EMAIL_ADDRESS\";' % email)
if __name__ == "__main__":
main()
示例3: Dialog
# 需要导入模块: from mysqlconf import MySQL [as 别名]
# 或者: from mysqlconf.MySQL import execute [as 别名]
elif opt == '--email':
email = val
if not password:
d = Dialog('TurnKey Linux - First boot configuration')
password = d.get_password(
"Kliqqi Password",
"Enter new password for the Kliqqi 'admin' account.")
if not email:
if 'd' not in locals():
d = Dialog('TurnKey Linux - First boot configuration')
email = d.get_email(
"Kliqqi Email",
"Enter email address for the Kliqqi 'admin' account.",
"[email protected]")
inithooks_cache.write('APP_EMAIL', email)
salt = ''.join((random.choice(string.letters+string.digits) for x in range(9)))
hash = salt + hashlib.sha1(salt + password).hexdigest()
m = MySQL()
m.execute('UPDATE kliqqi.users SET user_pass=\"%s\" WHERE user_login=\"admin\";' % hash)
m.execute('UPDATE kliqqi.users SET user_email=\"%s\" WHERE user_login=\"admin\";' % email)
if __name__ == "__main__":
main()
示例4: system
# 需要导入模块: from mysqlconf import MySQL [as 别名]
# 或者: from mysqlconf.MySQL import execute [as 别名]
# Solr - enable SSL.
# system("echo 'SOLR_SSL_KEY_STORE=etc/solr-ssl.keystore.jks' >> /var/lib/solr/solr.in.sh")
# system("echo 'SOLR_SSL_KEY_STORE_PASSWORD=%s' >> /var/lib/solr/solr.in.sh" % adminpass)
# system("echo 'SOLR_SSL_TRUST_STORE=etc/solr-ssl.keystore.jks' >> /var/lib/solr/solr.in.sh")
# system("echo 'SOLR_SSL_TRUST_STORE_PASSWORD=%s' >> /var/lib/solr/solr.in.sh" % adminpass)
# system("echo 'SOLR_SSL_NEED_CLIENT_AUTH=false' >> /var/lib/solr/solr.in.sh")
# system("echo 'SOLR_SSL_WANT_CLIENT_AUTH=false' >> /var/lib/solr/solr.in.sh")
# system("echo 'SOLR_SSL_OPTS=\"-Djavax.net.ssl.keyStore=etc/solr-ssl.keystore.jks -Djavax.net.ssl.trustStore=etc/solr-ssl.keystore.jks\"' >> /var/lib/solr/solr.in.sh")
# Drupal - check change admin/password.
try:
pwd.getpwnam('admin')
system("echo admin:%s | chpasswd" % adminpass)
m = MySQL()
m.execute('SET PASSWORD FOR [email protected] = PASSWORD(%s) ;' % adminpass)
except KeyError:
system("useradd -g root -m -s /bin/bash admin")
system("echo admin:%s | chpasswd" % adminpass)
m = MySQL()
m.execute('CREATE USER [email protected] IDENTIFIED BY \"%s\";' % adminpass)
# Drupal - check change cssadmin/password with toggle to create base site.
try:
# Check cssadmin exists with exception if not.
pwd.getpwnam('cssadmin')
# Change cssadmin password.
system("echo cssadmin:%s | chpasswd" % adminpass)
# Base site should already exist if cssadmin exists.
示例5: Dialog
# 需要导入模块: from mysqlconf import MySQL [as 别名]
# 或者: from mysqlconf.MySQL import execute [as 别名]
elif opt == '--pass':
password = val
elif opt == '--email':
email = val
if not password:
d = Dialog('TurnKey Linux - First boot configuration')
password = d.get_password(
"Collabtive Password",
"Enter new password for the Collabtive 'admin' account.")
if not email:
if 'd' not in locals():
d = Dialog('TurnKey Linux - First boot configuration')
email = d.get_email(
"Collabtive Email",
"Enter email address for the Collabtive 'admin' account.",
"[email protected]")
hash = hashlib.sha1(password).hexdigest()
m = MySQL()
m.execute('UPDATE collabtive.user SET pass=\"%s\", email=\"%s\" WHERE name=\"admin\";' % (hash, email))
m.execute('UPDATE collabtive.settings SET settingsValue=\"%s\" WHERE settingsKey=\"mailfrom\";' % email)
if __name__ == "__main__":
main()
示例6: locals
# 需要导入模块: from mysqlconf import MySQL [as 别名]
# 或者: from mysqlconf.MySQL import execute [as 别名]
"Magento Email",
"Enter email address for the Magento 'admin' account.",
"[email protected]")
if not domain:
if 'd' not in locals():
d = Dialog('TurnKey Linux - First boot configuration')
domain = d.get_input(
"Magento Domain",
"Enter the domain to serve Magento.",
DEFAULT_DOMAIN)
if domain == "DEFAULT":
domain = DEFAULT_DOMAIN
hashpass = hashlib.md5("qX" + password).hexdigest() + ":qX"
m = MySQL()
m.execute('UPDATE magento.admin_user SET email=\"%s\" WHERE username=\"admin\";' % email)
m.execute('UPDATE magento.admin_user SET password=\"%s\" WHERE username=\"admin\";' % hashpass)
m.execute('UPDATE magento.core_config_data SET value=\"http://%s/\" WHERE path=\"web/unsecure/base_url\";' % (domain))
m.execute('UPDATE magento.core_config_data SET value=\"https://%s/\" WHERE path=\"web/secure/base_url\";' % (domain))
# delete cache so it will be rebuilt for new domain
shutil.rmtree("/var/www/magento/var/cache", ignore_errors=True)
if __name__ == "__main__":
main()
示例7: locals
# 需要导入模块: from mysqlconf import MySQL [as 别名]
# 或者: from mysqlconf.MySQL import execute [as 别名]
"Enter new password for the ProjectPier 'admin' account.")
if not email:
if 'd' not in locals():
d = Dialog('TurnKey Linux - First boot configuration')
email = d.get_email(
"ProjectPier Email",
"Please enter email address for the ProjectPier 'admin' account.",
"[email protected]")
inithooks_cache.write('APP_EMAIL', email)
pos = random.randrange(25)
salt = hashlib.sha1(str(uuid.uuid4())).hexdigest()[pos:pos+13]
token = hashlib.sha1(salt + password).hexdigest()
x = [str(i) for i in range(10)]
random.shuffle(x)
twister = ''.join(x)
m = MySQL()
m.execute('UPDATE projectpier.users SET email = "%s", token = "%s", salt = "%s", twister = "%s", updated_on = NOW() WHERE id = 1;' % (email, token, salt, twister))
m.execute('UPDATE projectpier.contacts SET email="%s", updated_on=NOW() WHERE user_id = 1;')
if __name__ == "__main__":
main()
示例8: usage
# 需要导入模块: from mysqlconf import MySQL [as 别名]
# 或者: from mysqlconf.MySQL import execute [as 别名]
usage()
elif opt == '--pass':
password = val
elif opt == '--email':
email = val
if not password:
d = Dialog('TurnKey Linux - First boot configuration')
password = d.get_password(
"Wordpress Password",
"Enter new password for the Wordpress 'admin' account.")
if not email:
if 'd' not in locals():
d = Dialog('TurnKey Linux - First boot configuration')
email = d.get_email(
"Wordpress Email",
"Please enter email address for the Wordpress 'admin' account.",
"[email protected]")
hashpass = hashlib.md5(password).hexdigest()
m = MySQL()
m.execute('UPDATE wordpress.wp_users SET user_email=\"%s\" WHERE user_nicename=\"admin\";' % email)
m.execute('UPDATE wordpress.wp_users SET user_pass=\"%s\" WHERE user_nicename=\"admin\";' % hashpass)
if __name__ == "__main__":
main()
示例9: MySQL
# 需要导入模块: from mysqlconf import MySQL [as 别名]
# 或者: from mysqlconf.MySQL import execute [as 别名]
DEFAULT_DOMAIN)
if domain == "DEFAULT":
domain = DEFAULT_DOMAIN
fqdn = re.compile(r"https?://")
fqdn = fqdn.sub('', domain).strip('/')
domain = "https://%s/" % fqdn
inithooks_cache.write('APP_DOMAIN', fqdn)
salt = bcrypt.gensalt(10)
hashpass = bcrypt.hashpw(password, salt)
m = MySQL()
m.execute('UPDATE elgg.elgg_users_entity SET password_hash=\"%s\" WHERE username=\"admin\";' % hashpass)
m.execute('UPDATE elgg.elgg_users_entity SET email=\"%s\" WHERE username=\"admin\";' % email)
m.execute('UPDATE elgg.elgg_metastrings SET string=\"%s\" WHERE string LIKE \"%%@%%\";' % email)
m.execute('UPDATE elgg.elgg_sites_entity SET url=\"%s\" WHERE guid = 1;' % domain)
with open('/etc/cron.d/elgg', 'r') as fob:
contents = fob.read()
contents = re.sub("ELGG='.*'", "ELGG='%s'" % domain, contents)
with open('/etc/cron.d/elgg', 'w') as fob:
fob.write(contents)
apache_conf = "/etc/apache2/sites-available/elgg.conf"
示例10: locals
# 需要导入模块: from mysqlconf import MySQL [as 别名]
# 或者: from mysqlconf.MySQL import execute [as 别名]
"Enter email address for the ClipBucket 'admin' account.",
"[email protected]")
if not domain:
if 'd' not in locals():
d = Dialog('TurnKey Linux - First boot configuration')
domain = d.get_input(
"ClipBucket Domain",
"Enter the domain to serve ClipBucket.",
DEFAULT_DOMAIN)
if domain == "DEFAULT":
domain = DEFAULT_DOMAIN
hash = clipbucket_hash(password)
m = MySQL()
m.execute('UPDATE clipbucket.users SET password=\"%s\", email=\"%s\" WHERE username=\"admin\";' % (hash, email))
m.execute('UPDATE clipbucket.config SET value=\"%s\" WHERE name=\"support_email\";' % email)
m.execute('UPDATE clipbucket.config SET value=\"%s\" WHERE name=\"website_email\";' % email)
m.execute('UPDATE clipbucket.config SET value=\"%s\" WHERE name=\"welcome_email\";' % email)
m.execute('UPDATE clipbucket.config SET value=\"http://%s\" WHERE name=\"baseurl\";' % domain)
if __name__ == "__main__":
main()
示例11: locals
# 需要导入模块: from mysqlconf import MySQL [as 别名]
# 或者: from mysqlconf.MySQL import execute [as 别名]
"Enter new password for the SilverStripe 'admin' account.")
if not email:
if 'd' not in locals():
d = Dialog('TurnKey Linux - First boot configuration')
email = d.get_email(
"SilverStripe Email",
"Enter email address for the SilverStripe 'admin' account.",
"[email protected]")
salt = bcrypt.gensalt(10)
hash = bcrypt.hashpw(password, salt)
# munge the salt and hash, argh!
_salt = salt[4:]
_hash = "$2y$" + hash[4:]
m = MySQL()
m.execute('UPDATE silverstripe.Member SET Salt=\"%s\" WHERE ID=1;' % _salt)
m.execute('UPDATE silverstripe.Member SET Password=\"%s\" WHERE ID=1;' % _hash)
m.execute('UPDATE silverstripe.Member SET Email=\"%s\" WHERE ID=1;' % email)
m.execute('UPDATE silverstripe.MemberPassword SET Salt=\"%s\" WHERE ID=1;' % _salt)
m.execute('UPDATE silverstripe.MemberPassword SET Password=\"%s\" WHERE ID=1;' % _hash)
if __name__ == "__main__":
main()
示例12: Dialog
# 需要导入模块: from mysqlconf import MySQL [as 别名]
# 或者: from mysqlconf.MySQL import execute [as 别名]
if not password:
d = Dialog('TurnKey Linux - First boot configuration')
password = d.get_password(
"eZ Platform Password",
"Enter new password for the eZ Platform 'admin' account.")
if not email:
if 'd' not in locals():
d = Dialog('TurnKey Linux - First boot configuration')
email = d.get_email(
"eZ Platform Email",
"Enter email address for the eZ Platform 'admin' account.",
"[email protected]")
inithooks_cache.write('APP_EMAIL', email)
# tweak configuration files
# calculate password hash and tweak database
hash = hashlib.md5("admin\n%s" % password).hexdigest()
m = MySQL()
m.execute('UPDATE ezplatform.ezuser SET password_hash="%s" WHERE login="admin";' % hash)
m.execute('UPDATE ezplatform.ezuser SET email="%s" WHERE login="admin";' % email)
m.execute('UPDATE ezplatform.ezcontentobject_name SET name="TurnKey Linux eZ Platform" WHERE contentobject_id="1"')
if __name__ == "__main__":
main()
示例13: locals
# 需要导入模块: from mysqlconf import MySQL [as 别名]
# 或者: from mysqlconf.MySQL import execute [as 别名]
if not domain:
if 'd' not in locals():
d = Dialog('TurnKey Linux - First boot configuration')
domain = d.get_input(
"Elgg Domain",
"Enter the domain to serve Elgg.",
DEFAULT_DOMAIN)
if domain == "DEFAULT":
domain = DEFAULT_DOMAIN
domain = domain.strip("/")
if not domain.startswith("http://"):
domain = "http://%s/" % domain
salt = "".join(random.choice(string.letters) for line in range(8))
hashpass = hashlib.md5(password + salt).hexdigest()
m = MySQL()
m.execute('UPDATE elgg.elgg_users_entity SET salt=\"%s\" WHERE username=\"admin\";' % salt)
m.execute('UPDATE elgg.elgg_users_entity SET password=\"%s\" WHERE username=\"admin\";' % hashpass)
m.execute('UPDATE elgg.elgg_users_entity SET email=\"%s\" WHERE username=\"admin\";' % email)
m.execute('UPDATE elgg.elgg_metastrings SET string=\"%s\" WHERE string LIKE \"%%@%%\";' % email)
m.execute('UPDATE elgg.elgg_sites_entity SET url=\"%s\" WHERE url LIKE \"http://%%\";' % domain)
if __name__ == "__main__":
main()
示例14: locals
# 需要导入模块: from mysqlconf import MySQL [as 别名]
# 或者: from mysqlconf.MySQL import execute [as 别名]
"[email protected]")
if not password:
if 'd' not in locals():
d = Dialog('TurnKey Linux - First boot configuration')
password = d.get_password(
"Vtiger Password",
"Enter new password for the Vtiger 'admin' account.")
hashpass = hashlib.md5(password).hexdigest()
command = ["php", join(dirname(__file__), 'vt_crypt.php'), "admin", password]
p = subprocess.Popen(command, stdin=PIPE, stdout=PIPE, shell=False)
stdout, stderr = p.communicate()
if stderr:
fatal(stderr)
cryptpass = stdout.strip()
m = MySQL()
m.execute('UPDATE vtigercrm.vtiger_users SET email1=\"%s\" WHERE user_name=\"admin\";' % email)
m.execute('UPDATE vtigercrm.vtiger_users SET user_hash=\"%s\" WHERE user_name=\"admin\";' % hashpass)
m.execute('UPDATE vtigercrm.vtiger_users SET user_password=\"%s\" WHERE user_name=\"admin\";' % cryptpass)
if __name__ == "__main__":
main()
示例15: Dialog
# 需要导入模块: from mysqlconf import MySQL [as 别名]
# 或者: from mysqlconf.MySQL import execute [as 别名]
elif opt == '--pass':
password = val
elif opt == '--email':
email = val
if not password:
d = Dialog('TurnKey Linux - First boot configuration')
password = d.get_password(
"SimpleInvoices Password",
"Enter new password for the 'admin' account.")
if not email:
if 'd' not in locals():
d = Dialog('TurnKey Linux - First boot configuration')
email = d.get_email(
"SimpleInvoices Email",
"Enter email address for the 'admin' account.",
"[email protected]")
hash = hashlib.md5(password).hexdigest()
m = MySQL()
m.execute('UPDATE simpleinvoices.si_user SET password=\"%s\" WHERE id=1;' % hash)
m.execute('UPDATE simpleinvoices.si_user SET email=\"%s\" WHERE id=1;' % email)
if __name__ == "__main__":
main()