Home  >  Article  >  Database  >  CentOS下安装启动MySQL及调用QT

CentOS下安装启动MySQL及调用QT

WBOY
WBOYOriginal
2016-06-07 17:00:331321browse

一、安装,启动mySQL:1、CentOS中如果已经有了mySQL /etc/rc.d/init.d/./mysqld start (启动mySQL, 此时可以运行mySQL -r

一、安装,启动mySQL:

1、CentOS中如果已经有了mySQL

      /etc/rc.d/init.d/./mysqld start   (启动mySQL, 此时可以运行mySQL -root)

      编辑rc.local文件  #vi /etc/rc.d/rc.local

      加入如下启动命令

      /etc/rc.d/init.d/mysqld start

      (mySQL 开机自动启动)

2、如果没有安装:

   1>、yum install mysql,,

      安装后  需要重复 1 的步骤  设置开机自动重启;

   2>、 p { margin-bottom: 0.08in; }

     For CentOS 32-bit system: Get rpm

wget

wget

wget

wget

wget

p { margin-bottom: 0.08in; }

wget

    For CentOS 64-bit system: Get rpm

p { margin-bottom: 0.08in; }

wget


wget

wget

wget

wget


Install

rpm -iUvh MySQL-server-community-5.0.92-1.rhel5.i386.rpm

rpm -iUvh MySQL-client-community-5.0.92-1.rhel5.i386.rpm

rpm -iUvh MySQL-devel-community-5.0.92-1.rhel5.i386.rpm

rpm -iUvh MySQL-shared-community-5.0.92-1.rhel5.i386.rpm

rpm -iUvh MySQL-shared-compat-5.0.92-1.rhel5.i386.rpm

rpm包安装会设置开机自动重启,不需要重复1的步骤。

二、编译安装mysql 使Qt能调用。   p { margin-bottom: 0.08in; }

export PATH=/opt/qtsdk-2010.04/qt/bin:$PATH

cd /opt/qtsdk-2010.04/qt/src/plugins/sqldrivers/mysql/

for 32-bit:

qmake -o Makefile 'INCLUDEPATH+=/usr/include/mysql' 'LIBS+=-L/usr/lib/mysql' mysql.pro

for 64-bit

qmake -o Makefile 'INCLUDEPATH+=/usr/include/mysql' 'LIBS+=-L/usr/lib64 /mysql' mysql.pro

make

cp libqsqlmysql.so ../../../../plugins/sqldrivers/

如果在qmake时候提示:qpluginbase.pri:10: Unknown replace function: qtLibraryTarget

则是因为export PATH=/opt/qtsdk-2010.04/qt/bin:$PATH  参数(path)错误

如果在make时候提示:../../../sql/drivers/mysql/qsql_mysql.h:52:19: error: mysql.h: No such file or directory

缺少mysql-devel

yum install mysql-devel

重新make

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn