setupdb.cpp
来自「在qt环境下开发的PPP拨号程序,具有良好的操作界面,方便开发通信程序」· C++ 代码 · 共 25 行
CPP
25 行
#include <iostream.h>#include <string>#include <mysql/mysql.h>string mysqlrootpwd;string command;MYSQL mysql;int main(int argc, char** argv){ cout << "MyPPP uses the MySQL database to record monthly usage time." << endl; cout << "Therefore, the setup program needs to configure MySQL by adding" << endl; cout << "a privileged MyPPP user account. In order to do so, the setup" << endl; cout << "program needs to know the MySQL root password." << endl; cout << "(Note: This is not a Unix login password.)" << endl; cout << endl; cout << "Please enter the MySQL root password -> "; cin >> mysqlrootpwd; mysql_init(&mysql); mysql_real_connect(&mysql,"localhost","root",mysqlrootpwd.c_str(), "myppp",0,NULL,0); mysql_query(&mysql, "GRANT ALL PRIVILEGES ON myppp.* TO myppp@localhost"); mysql_query(&mysql, "SET PASSWORD FOR myppp@localhost=PASSWORD(\"squirrel\")");}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?