Windows7 QT5.6.0 (64-bit) use MySQL (64-bit) environment to build a detailed

Source: Internet
Author: User
Tags mysql client

1 description

Use the environment for: Windows7 VS2015 QT5.6.0 (64-bit), MYSQL 5.7.13 (64-bit).

Online various errors, vague, abstract information, configuration environment spent half a day, a lesson from the bitter, summed up, convenient Yimeimei.

Original, reproduced please indicate the source. 2 method/Step 2.1 download and install QT and MySQL

QT and MySQL installation sections in sequence. (VS2015, of course, should also be installed, not described here). 2.1.1 Download install mysql 2.1.1.1 download mysql

: http://dev.mysql.com/downloads/mysql/

The above is the official website compressed version of the address, I was (20160723) downloaded the latest version of the 61-bit software, (mysql-5.7.13-winx64.zip)

Note: To register when downloading, registration is free, harmonious and friendly, after registration to download. 2.1.1.2 Installing MySQL

Unzip the software and get the Mysql-x.x.xx-winx64 folder.

Create a new My.ini and delete the My-default.ini file. The contents of the My.ini file are as follows, please note that the directory where the database data is stored must be empty (datadir field):

[MySQL]

# Set the MySQL client default character set

Default-character-set=utf8

[Mysqld]

#设置3306端口

Port = 3306

# set up the MySQL installation directory

Basedir=d:\mysql\

# Set up a storage directory for MySQL database data

datadir=D:\mysql\data

# Maximum number of connections allowed

max_connections=200

# The character set used by the service side defaults to the 8-bit encoded latin1 character set

Character-set-server=utf8

# The default storage engine that will be used when creating a new table

Default-storage-engine=innodb 2.1.1.3 setting MySQL environment variables

Modify the path variable, and at the end add the bin directory of the MySQL compression package, for example mine is:

C:\ProgramData\Oracle\Java\javapath; C:\Program Files (x86) \intel\icls client\; C:\Program Files\intel\icls client\;%systemroot%\system32;%systemroot%;%systemroot%\system32\wbem;%systemroot%\ System32\windowspowershell\v1.0\; C:\Program Files\intel\intel (R) Management Engine components\dal; C:\Program Files\intel\intel (R) Management Engine components\ipt; C:\Program Files (x86) \intel\intel (R) Management Engine components\dal; C:\Program Files (x86) \intel\intel (R) Management Engine components\ipt; C:\Program Files (x86) \intel\opencl sdk\2.0\bin\x86; C:\Program Files (x86) \intel\opencl sdk\2.0\bin\x64; C:\Program Files\dell\dell Data protection\access\advanced\wave\gemalto\access client\v5\; C:\Program Files (x86) \ntru Cryptosystems\ntru TCG software stack\bin\; C:\Program files\ntru cryptosystems\ntru TCG software stack\bin\; C:\Program Files (x86) \microsoft SQL server\100\tools\binn\; C:\Program Files\Microsoft SQL Server\100\tools\binn\; C:\Program Files\Microsoft SQL Server\100\dts\binn\;D: \data_stOre\svn\bin; C:\Program FILES\VISUALSVN Server\Bin; C:\Program Files (x86) \ Windows Kits\8.1\windows performance toolkit\; C:\Program Files\Microsoft SQL Server\110\tools\binn\;%userprofile%\.dnx\bin; C:\Program Files\Microsoft Dnx\dnvm\; C:\Program Files\Microsoft SQL Server\130\tools\binn\; E:\mysql\mysql-5.7.13-winx64\bin

2.1.1.4 Installing and starting the MySQL service

Run Cmd.exe as an administrator (search cmd, then right-click, run as Administrator), execute the following command:

Mysqld Install

Mysqld--initialize-insecure--user=mysql

net start MySQL

Simply say the above command function, the first: the installation of MySQL service; second: Initialize MySQL, root password is empty, and third, start the MySQL service. 2.1.1.5 try to log in to MySQL, confirm MySQL installation OK

Mysql-uroot–p

PS: How to set Password: mysqladmin-u root-p password XXX 2.2 download and install QT

QT Installation Address: http://download.qt.io/archive/qt/

Install the corresponding version, mine is, enter 5.6, enter 5.6.0, select VS2015 64-bit installation package.

Of course, install the QT5.6.0, also install the VS2015 Community Edition, install the VS2015 plugin (qt5package.vsix). 2.3 QT5.6.0 using MySQL

It's critical that a bunch of people on the web say you need to compile the MySQL library, in fact, that version doesn't need! (Other versions are not discussed).

Copy the Libmysql.dll file from the MySQL directory mysql-5.7.13-winx64\lib to the directory of the Qt installation bin directory (I am:C:\Qt\Qt5.6.0_vs2015\5.6\ Msvc2015_64\bin).

Otherwise the connection database will be error: Qsqldatabase:qmysql driver not loaded 2.3.1 test code

Qsqldatabase db = qsqldatabase::d atabase ("Qmysql");

Db.sethostname (M_hostname);

Db.setport (M_port);

Db.setdatabasename ("Configuration");

V.setusername ("root");

Db.setpassword ("");

if (!m_db.open ())

{

Qdebug () << m_db.lasterror (). text ();

}

Windows7 QT5.6.0 (64-bit) use MySQL (64-bit) environment to build a detailed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.