(一)伺服端(insecta.idv.tw)
mysql> GRANT ALL ON ilvssell.* to treehrt@tree.kmvs.km.edu.tw; Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON *.* to 'treehrt'@'%' IDENTIFIED by "?" WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)
mysql> use mysql; Database changed mysql> UPDATE user SET Password=PASSWORD('?') where USER='treehrt'; Query OK, 1 row affected (0.00 sec) Rows matched: 4 Changed: 1 Warnings: 0
mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)
(二)用戶端程式碼(tree.kmvs.km.edu.tw)
if (mysql_real_connect(con, "insecta.idv.tw", "treehrt", "?", NULL, 0, NULL, 0) == NULL) { fprintf(stderr, "%s\n", mysql_error(con)); mysql_close(con); exit(1); } |