MySql C++調用庫Connector/c++編譯 和 接口封裝【一】mysql數據庫安裝

Connector/c++庫的源文件編譯,你須要先準備好如下工具:
    mysql數據庫(編譯時要依賴),boost庫,cmake(生成sln工程文件),connector/c++的源文件,visual stdio 2003版本以上。例子使用vs2010。
 
1、mysql數據庫安裝:
1.先安裝windows下,建議去官服下載 install 版本。 zip版其實和 install同樣的。但zip版要大多了。
下載連接: http://dev.mysql.com/downloads/windows/installer/  下面有個 Select Platform: 的選項,不過要FQ才能選。
 
2.把mysql安裝目錄下的 bin目錄,加入環境變量。
  1.mysql目錄下的 my-default.ini  爲參考,修改 my.ini文件。下面的是參考:
  
[client]
password    = 123456
port        = 3306
socket        = /tmp/mysql.sock

[mysqld]
basedir=C:/Program Files/MySQL/MySQL Server 5.6
datadir=C:/Program Files/MySQL/MySQL Server 5.6/data
log-error=C:/Program Files/MySQL/MySQL Server 5.6/log/mysql.log
port        = 3306
socket    = /tmp/mysql.sock

 

  2. 控制檯(cmd)輸入:
mysqld --install MySQL --defaults-file="C:\Program Files\MySQL\MySQL Server 5.6\my.ini"
  3. 啓動服務: 
net start MySQL   //net start MySQL 可能會提示 1067錯誤,就是配置錯誤。有時會出現,有時沒有。按網上的建議,沒弄沒白規律

   net start MySql 只須要第一次啓動執行。之後開機後,會自動啓動服務。能夠去php

  ps:關閉並刪除服務命令:html

net stop MySQL
sc delete MySQL

 

附官服的啓動說明:mysql

User Comments

Posted by Paolo Lancelli on October 24 2007 2:56pm [Delete] [Edit]

In case you receive "The system cannot find the file specified", remember that you have to install the service with the absolute path, in my case "C:\mysql\bin\mysqld --install". I added the \bin to the windows path, and I was installing the service only with "mysqld --install".c++

Posted by Junaid Nazir on December 29 2007 9:14pm [Delete] [Edit]

As mentioned earlier by another user, I fell into the trap of adding MySQL to start as a service via a command like

C:\> mysqld --install

The service is reported as being installed successfully, however, under the Services panel it shows the executable path as 'C:\mysqld' when in fact it is located under 'C:\mysql\bin'. I was working under the assumption that the mysql\bin directory had been added to the system PATH variable, but really you need to use absolute file paths when installing services. In my case, I used;

C:\> C:\mysql\bin\mysqld --install MySQL --defaults-file=C:\mysql\my.ini

This starts the service automatically with Windows bootup, and will load the my.ini configuration file which you have to place within the mysql directory. For the first time however, you will need to start the mysql service manually, since the earlier command makes mysql start and end with windows shutdowns and restarts.

net start mysqlsql

Posted by bob eff on June 8 2008 4:16am [Delete] [Edit]

If you have problems installing the service on Windows Vista, just run the normal install and add the service manually with the following command:

use the sc create command in a dos window to add the service: 

sc create MySQL start= auto DisplayName= MySQL binPath= c:\program files\mysql\mysql server 5.1\bin\mysqld.exe

then if you need to alter any parameters, use the administrative tools/services utility數據庫

Posted by Baruch Atta on January 14 2010 5:49pm [Delete] [Edit]

Another "got-ya"... Make sure your my.ini file is in your MySQL directory, and the variables are pointing to the correct directories. windows

Posted by Rich Wingerter on July 5 2011 3:09am [Delete] [Edit]

In order to overcome the "The system cannot find the file specified" message, I had to use the short 8dot3 names because my command program would not take the long names in quotes. Since I have mysql installed under EasyPHP on the D: drive, I had to use:

D:\progra~2\easyph~1.0\mysql\bin\mysqld --install

to get to mysqld in

D:\Program Files (x86)\EasyPHP-5.3.6.0\mysql\bin

You can get the short names with the directory command:

DIR /Xsocket

相關文章
相關標籤/搜索