linux找不到mysql.h(串連不到mysql.h),linuxmysql.h

來源:互聯網
上載者:User

linux找不到mysql.h(串連不到mysql.h),linuxmysql.h
編寫C語言程式connect1.c與MySQL資料庫建立串連,在命令列輸入:gcc connect1.c -o connect1.exe -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient

顯示找不到mysql.h,如下(圖1)所示:

原因是安裝MySQL時只是安裝了MySQL的伺服器和MySQL的用戶端,沒有安裝MySQL database development files.

解決辦法:

1.圖形介面操作:直接在軟體中心輸入MySQL database development files或者libmysqlclient-dev,點擊安裝.(2所示)

2.命令列下:輸入sudo apt-get instal libmysqlclient-dev,輸入密碼(3所示),安裝完成後輸入whereis mysql.h則出現/usr/include/mysql,說明mysql.h可以被使用.


相關文章

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.