樹心幽徑

« 20180505在Ubuntu裝VMware tools | Main | 20180518在ubuntu裝mysql-server »

20180517安裝ubuntu mysql c connector並設計一個顯示mysql版本的程式
2018/05/17,14:02

treehrt@hrt:~$ sudo apt-get install libmysqlcppconn-dev
[sudo] password for treehrt:
:

設定 libmysqlclient20:i386 (5.7.22-0ubuntu0.16.04.1) ...
設定 libmysqlcppconn7v5 (1.1.7-0ubuntu1) ...
設定 libmysqlcppconn-dev (1.1.7-0ubuntu1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
treehrt@hrt:~$

 

treehrt@hrt:~$ sudo apt-get install libmysql++-dev

:
設定 libmysql++3v5 (3.2.2+pristine-1ubuntu1) ...
設定 zlib1g-dev:i386 (1:1.2.8.dfsg-2ubuntu4.1) ...
設定 libmysqlclient-dev (5.7.22-0ubuntu0.16.04.1) ...
設定 libmysql++-dev (3.2.2+pristine-1ubuntu1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
treehrt@hrt:~$

 

treehrt@hrt:~/mysqlc$ sudo apt-get install libmysqlclient-dev

:

libmysqlclient-dev is already the newest version (5.7.22-0ubuntu0.16.04.1).
libmysqlclient-dev 被設定為手動安裝。

treehrt@hrt:~/mysqlc$ cat t1.c
#include <my_global.h>
#include <mysql.h>

int main(int argc, char **argv)
{
  printf("MySQL client version: %s\n", mysql_get_client_info());

  exit(0);
}
treehrt@hrt:~/mysqlc$

 

treehrt@hrt:~/mysqlc$ gcc t1.c `mysql_config --cflags --libs`

 
treehrt@hrt:~/mysqlc$ ./a.out
MySQL client version: 5.7.22

 

迴響

 
Accessible and Valid XHTML 1.0 Strict and CSS Powered by LifeType