## 28.4.1 Connecting to the MySQL Database

- Get a connection handle:

  > `MYSQL* connection = mysql_init();`

- Make connection using handle:

  > `mysql_real_connect(connection, NULL, NULL, NULL,
  > "bigcpp", 0, NULL, 0)`

  Arguments are:

  - A ptr to an initialised connection
  - Three strings: hostname, username, password. `NULL` to use defaults
  - DB name (`bigcpp`)
  - Last three should be the defaults `(0, NULL, 0)`

prev |top |next