QtCreator link mysql database and mysql Chinese garbled characters

Source: Internet
Author: User
Tags qt designer
QtCreator links to the mysql database and mysql Chinese garbled environment: ubuntu10.10qt4mysql5 and the required lib (Many lib) projects need to use qt, so the QtCreator (qc) is launched, which is not bad, so I immediately abandoned qtdesigner and qdevelop. I will not introduce the connection principle here. Qc link mysql: 0. New

Qt Creator links to the mysql database and mysql Chinese garbled environment: ubuntu10.10 qt4 mysql5 and the required lib (Many lib) projects need to use qt, so the Qt Creator (qc) is launched, which is not bad, so I immediately abandoned qt designer and qdevelop. I will not introduce the connection principle here. Qc link mysql: 0. New

Qt Creator link mysql database and mysql Chinese garbled characters

Environment: ubuntu10.10 qt4 mysql5 and necessary lib (Many lib)

Qt is required for the project, so Qt Creator (qc) is used, which is not bad, so I immediately abandoned qt designer and qdevelop.

I will not introduce the connection principle here.

Qc link mysql:

0. Create a new project qt gui application, and then you can run it. Delete all files except *. pro.

1. copy the/usr/lib/qt4/demos/sqlbrowser file (if not), except for *. pro file and runable file. add them to the project;

2. Add QT + = SQL to the *. pro file of the project.

Final Result: QT + = core gui SQL (SQL is newly added)

3. Rebuild

4. Run

Mysql Chinese garbled characters:

Mysql uses latin1 by default.

So you need to modify

/Etc/mysql/my. cnf

In [cleint]

Add: default-character-set = utf8

[Mysqld]

Add: default-character-set = utf8

Restart:

Service mysql restart

Later I found garbled characters:

Back up the data and re-establish the database;

For details, refer to the following URL:

Http://chenshaoao.blog.163.com/blog/static/91128110200901994129218/

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.