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/