iT邦幫忙

0

C 語言 連接MYDQL 方法 與學習該如何開始

  • 分享至 

  • twitterImage

想請問各位大神
如果使用C 直接與mysql連線並操作該如何使用,我已經有在mysql官網看到mysql.h,但是不知道該如何引入檔案,有沒有可以提供詳細一點的說明,還有學c語言的指標和排程該如何學起?,剛入門很沒有方向
感謝各位

看更多先前的討論...收起先前的討論...
弦外之音....

不是說用C做資料庫不好,而是你的學習曲線會非常大,撇開從零入門到精通資料存取所花的學習時間會非常可觀不談,用C#用PYTHON對資料庫操作可能是幾行字的事,用C.........幾十上百行都有可能...

如果你是想學習理論,無可厚非

但如果你是要解決當前的問題,我還是建議你換用其他適合資料庫開發的語言,如PYTHON或C#或JAVA
froce iT邦大師 1 級 ‧ 2021-03-16 12:49:40 檢舉
沒有那麼難啦,只是C的話好像你要在windows下非VS環境引lib你得自己會設置...
linux的話好處理多了。

如果是寫慣C,沒有一定要用C寫,然後又要編譯的,我會建議用go寫。
不好意思 沒有說清楚 我是要在linux環境下進行
froce iT邦大師 1 級 ‧ 2021-03-16 15:52:20 檢舉
那就像下面那篇一樣,先裝對應的dev套件,然後下編譯指令
建議先學 Python . 比較好上手.
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 個回答

1
一級屠豬士
iT邦大師 1 級 ‧ 2021-03-16 16:36:57
最佳解答

https://dev.mysql.com/doc/c-api/8.0/en/c-api-building-clients.html

先看官網文件:

You may need to specify an -I option when you compile client programs that use MySQL header files, so that the compiler can find them. For example, if the header files are installed in /usr/local/mysql/include, use this option in the compile command:

-I/usr/local/mysql/include

MySQL clients must be linked using the -lmysqlclient option in the link command. You may also need to specify a -L option to tell the linker where to find the library. For example, if the library is installed in /usr/local/mysql/lib, use these options in the link command:

-L/usr/local/mysql/lib -lmysqlclient

1
海綿寶寶
iT邦大神 1 級 ‧ 2021-03-16 11:31:21

Google c mysql 可以看到很多篇

這篇最後修改是 2020/09/23
算是比較新的

提供參考

好的謝謝你 我參考一下

我要發表回答

立即登入回答