MySQL - MySQL介面設計之mysql-connector-c源碼安裝

來源:互聯網
上載者:User

標籤:

mysql官網提供了各類mysqlclient,提供開發人員使用進行mysql介面開發,其中linux版本根據分支和分支版本提供了各不相同的包。

由於我的是ubuntu 16.04的最新版本,並沒有找到相對應的開發包,而且考慮到後續版本升級和移植問題,還是採用源碼包的方式最為可靠。

但是源碼包並沒有提供安裝說明,找了半天在官網找到了安裝教程。

4.2.1 Installing Connector/C from Source on Unix and Unix-Like Systems

If the native compiler toolset for the target platform is available (for example, SunStudio for Solaris), you can use that for compilation. Alternatively, the GNU toolset can be used on all platforms.

You also need CMake 2.6 or newer, which is available from cmake.org.

To build and install the source distribution, use the following procedure:

  1. Change location to the top-level directory of the source distribution.

  2. Generate the Makefile:

    shell> cmake -G "Unix Makefiles"

    Or, for a Debug build:

    shell> cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug

    By default, the installation location for Connector/C is /usr/local/mysql. To change this location, use the CMAKE_INSTALL_PREFIX option to specify a different directory when generating the Makefile. For example:

    shell> cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/opt/local/mysql

    For other CMake options that you might find useful, see Other Connector/C Build Options.

     

  3. Build the project:

    shell> make

     

  4. As root, install the Connector/C headers, libraries, and utilities:

     

     

    root-shell> make install

執行完一系列cmake後將產生makefile檔案

注意將第二步中的install目錄設定到自己的檔案路徑下

MySQL - MySQL介面設計之mysql-connector-c源碼安裝

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.