📄 setupdb.cpp
字号:
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -