0

Recently I'm trying to build a tool to synchronize data between databases using binlog. The way to do this is kind of like, the tool pretends to be a MySQL server and then communicates with a real MySQL server via MySQL C/S protocol. I went to github, and found some tools that Do the same thing, so I started to read their codes. The problem is, these tools are using some header files include m_ctype.h sql_common.h.I have libmysqlclient-dev installed, but these headers are not in /usr/local/includ. Basically I want to use simple_command(), which is a macro in these files, to send data packages to the real server. Then I found these files are in the source codes of MySQL. So how can I get these headers and make these functions and macros work? Should I :

  1. copy these files to include folder and link to libmysqlclient like mysql_config shows
  2. install another lib, maybe libmysql or something, and then I will get the headers and make things work

or Do any other things?

If there are other ways to implement MySQL c/s protocol, that will be fine, too.


I checked files of libmysqlclient-dev listed on ubuntu package, and I found that the lib I installed following instructions on dev.mysql.com has a lot of headers missing, include my_global.h my_config.h etc. Is this because i'm using MySQL's apt source? Or for some other reasons?

BowenDean
  • 1
  • 4
  • Are you perhaps looking for [libmariadb-dev](https://packages.ubuntu.com/eoan/amd64/libmariadb-dev/filelist)? (packages.ubuntu.com allows you to search for packages containing a specific file) – Botje Jan 31 '20 at 16:26
  • @Botje I'm not sure cause I found everything I want just in MySQL source codes, in mysql-8.0.19/include, and I don't even know what is libmariadb-dev... – BowenDean Jan 31 '20 at 16:34
  • I linked you to the file list, which is what you get if you install that package (on Ubuntu 19.10 at least) – Botje Jan 31 '20 at 16:37
  • @Botje I see but I think there shoud be something like 'libmysql***' which can save me. I'll try lib in your link, thanks! – BowenDean Jan 31 '20 at 16:39
  • Ubuntu 19.04 was the [last Ubuntu version](https://packages.ubuntu.com/search?searchon=contents&keywords=sql_common.h&mode=exactfilename&suite=disco&arch=any) to contain both MySQL and MariaDB (the open-source fork of MySQL). Their wire protocol should still be compatible, so you should be able to use `libmariadb-dev` without issues. – Botje Jan 31 '20 at 16:43
  • @Botje I just found that the headers I need are listed in https://packages.ubuntu.com/bionic/amd64/libmysqlclient-dev/filelist but for some reason I did not see them after my installation.I think this may because the version I installed is different. Anyway I loose some headers while install. I'll reinstall libmysql-dev. Thanks again for let me know that package files can be seen on packages.ubuntu.com. – BowenDean Jan 31 '20 at 16:52
  • You can check the contents of a package with `dpkg -L libmysqlclient-dev`. It may vary according to your distro version. – Botje Feb 01 '20 at 01:00
  • @Botje I checked this package. It seems the version 8.0.19 has some files removed. Maybe they don't want programs to use internal APIs. – BowenDean Feb 01 '20 at 03:19

0 Answers0