fedora15 eclipse配置 mysql(c++)

来源:互联网 发布:高频套利算法 编辑:程序博客网 时间:2024/04/28 02:06

1 安装mysql:

   yum install mysql*

  配置mysql:

[root@sample ~]#vim /etc/my.cnf  ← 编辑MySQL的配置文件

[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

# Default to using old password format for compatibility with mysql 3.x

# clients (those using the mysqlclient10 compatibility package).

old_passwords=1  ← 找到这一行,在这一行的下面添加新的规则,让MySQL的默认编码为UTF-8

default-character-set = utf8  ← 添加这一行

然后在配置文件的文尾填加如下语句:

[mysql]

default-character-set = utf8

启动MySQL服务
[root@sample ~]# chkconfig mysqld on  ← 设置MySQL服务随系统启动自启动
[root@sample ~]# chkconfig --list mysqld  ← 确认MySQL自启动 
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off  ← 如果2--5为on的状态就OK
[root@sample ~]#/etc/rc.d/init.d/mysqld start  ← 启动MySQL服务

2 eclipse配置环境:

在项目->属性->C/C++Build -> settings -> gcc c++ complier -> includes -> include paths 

添加路径:/usr/include/mysql

项目->属性->C/C++Build -> settings -> gcc c++ linker-> libraries 

libraries(l) 中添加两个参数mysqlclient和m

libraryies search path (L)中添加/usr/lib64/mysql(64位系统)

http://www.byywee.com/page/M0/S257/257590.html

http://www.vijun.com/database/mysql/5f84f4d934c11eb60134c6ad3e6c0037.html


    

原创粉丝点击