CentOS下安裝啟動MySQL及調(diào)用QT |
發(fā)布時間: 2012/9/12 17:18:24 |
一、安裝,啟動mySQL: 1、CentOS中如果已經(jīng)有了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, 安裝后 需要重復(fù) 1 的步驟 設(shè)置開機自動重啟; 2>、 p { margin-bottom: 0.08in; } For CentOS 32-bit system: Get rpm wget http://mysql.mirrors.pair.com/Downloads/MySQL-5.0/MySQL-server-community-5.0.92-1.rhel5.i386.rpm wget http://mysql.mirrors.pair.com/Downloads/MySQL-5.0/MySQL-client-community-5.0.92-1.rhel5.i386.rpm wget http://mysql.mirrors.pair.com/Downloads/MySQL-5.0/MySQL-devel-community-5.0.92-1.rhel5.i386.rpm wget http://mysql.mirrors.pair.com/Downloads/MySQL-5.0/MySQL-shared-community-5.0.92-1.rhel5.i386.rpm wget http://mysql.mirrors.pair.com/Downloads/MySQL-5.0/MySQL-shared-compat-5.0.92-1.rhel5.i386.rpm p { margin-bottom: 0.08in; } wget http://mysql.mirrors.pair.com/Downloads/MySQL-5.0/MySQL-server-community-5.0.92-1.rhel5.x86_64.rpm For CentOS 64-bit system: Get rpm p { margin-bottom: 0.08in; } wget http://mysql.mirrors.pair.com/Downloads/MySQL-5.0/MySQL-server-community-5.0.92-1.rhel5.x86_64.rpm
wget http://mysql.mirrors.pair.com/Downloads/MySQL-5.0/MySQL-devel-community-5.0.92-1.rhel5.x86_64.rpm wget http://mysql.mirrors.pair.com/Downloads/MySQL-5.0/MySQL-shared-community-5.0.92-1.rhel5.x86_64.rpm wget http://mysql.mirrors.pair.com/Downloads/MySQL-5.0/MySQL-shared-compat-5.0.92-1.rhel5.x86_64.rpm
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包安裝會設(shè)置開機自動重啟,不需要重復(fù)1的步驟。 二、編譯安裝mysql 使Qt能調(diào)用。 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 參數(shù)(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
本文出自:億恩科技【mszdt.com】 服務(wù)器租用/服務(wù)器托管中國五強!虛擬主機域名注冊頂級提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM] |