SHARE
TWEET

Untitled

a guest Oct 3rd, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import clr;
  2. import System;
  3.  
  4. clr.AddReference("TCAdmin.DatabaseProviders.MySql");
  5. clr.AddReference("TCAdmin.SDK");
  6. from TCAdmin.DatabaseProviders.MySql import MySqlManager;
  7. from System import String;
  8.  
  9. mysql_server="localhost";
  10. mysql_root="root";
  11. mysql_password="u2MXwkw9ZUbwsud5";
  12.  
  13. with MySqlManager() as mysql:
  14.  escapeduser=mysql.PrepareSqlValue(ThisService.Variables["MySQLUser"]);
  15.  escapeddb=mysql.PrepareSqlValue(ThisService.Variables["MySQLDB"]);
  16.  escapedpass=mysql.PrepareSqlValue(ThisService.Variables["MySQLPass"]);
  17.  mysql.Connect(String.Format("Data Source={0};User Id={1};Password={2};Pooling=False;", mysql_server, mysql_root, mysql_password));
  18.  
  19.  mysql.ExecuteNonQuery(String.Format("CREATE DATABASE {0};", escapeddb));
  20.  mysql.ExecuteNonQuery(String.Format("GRANT ALL PRIVILEGES ON {0}.* TO '{1}'@'localhost' IDENTIFIED BY '{2}';", escapeddb, escapeduser, escapedpass));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top