In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
There are two ways to connect to the MySQL database by using cymbals _ database _ c
The first one: connect with ADO
The second is to connect with MySQL's own API function.
The first ADO can connect to a variety of databases, such as mysql, sqlserver, oracle, access, and so on.
The second API method only aims at the connection to the mysql database without installing the MyODBC server program.
Here I use the API method to connect to the mysql database, which is more efficient than the ADO method. (the first way can be studied later)
Version of the virtual machine: redhat7.0 64bit
Version of the database: MySQL5.7 (installed)
1. Copy the corresponding library and header file in the extracted file to the location where the system can find it.
For example, the files in which I installed the database were all under: / usr/local/
Execute: cp / usr/local/include/* / usr/include/
Note that when copying, if the * contains a folder, you need to use:
Cp-r / usr/local/include/* / usr/include/
(cp will recursively copy all subdirectories and files under this directory.)
Write a random test file: 1.cpp
# include
# include
Using namespace std
Int main ()
{
MYSQL * connection
Connection = mysql_init (NULL)
Return 0
}
Then compile the file with Gmail +-o 1 1.cpp-lmysqlcient
Unfortunately, it is expected that there is another problem:
Caused by the library file cannot be found.
Terminal input command: mysql_config-- libs
Now we compile with a path to execute: Gmail +-L/usr/local/lib/mysql-lmysqlclient-o 1 1.cpp
Compiled and passed.
When linking, the default path is / usr/local/lib, and there is an extra layer of directory. We copy the files under mysql to lib.
Execute: cp / usr/local/lib/mysql/* / usr/local/lib/
It doesn't matter whether to delete the mysql folder under lib at this time.
Execute the 1.cpp +-o 1 1.cpp-lmysqlclient compilation again.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.