libmysqlclient.so.18 =>not found in centOS7



  • I connected MySQL using mariaDB.
    But Qt program cant open QMySQL driver.
    I figure out libmysqlclient.so.18 is missing.

    Before solving problem..
    You have to check mysqlclient library .
    Enter qt source code and enter sqldrivers.

    0_1461041405649_libqsqlpsql.png

    Open the terminal.

    1. Type yum install libmysqlclient* . It will be installed mariadb-libs packages.
      0_1461041064823_mariadb-lib.png

    2. Find out libmysqlclient.so
      [root@localhost lib]# find / -name libmysqlclient.so
      /usr/local/mariadb/lib/libmysqlclient.so
      /usr/local/src/build/libmysql/libmysqlclient.so

    3. Enter mariadb path. /usr/local/mariadb/lib

    4. edit ./bash_profile and register.
      [root@localhost lib]# vi ~/.bash
      .bash_history .bash_logout .bash_profile .bashrc
      [root@localhost lib]# vi ~/.bash_profile
      // add this on PATH
      PATH=$PATH:$HOME/bin:/usr/local/mariadb/bin:/usr/local/mariadb/lib
      [root@localhost lib]# source ~/.bash_profile

    5. check libmysqlclient.so on mariadb path
      [root@localhost sqldrivers]# ldd libqsqlmysql.so
      check libmysqlclient.so in mariadb

    0_1461041104930_sqlconnect.png

    1. enter qt build source code
      [root@localhost Qt5.6_x64]# ls
      bin doc examples include lib mkspecs phrasebooks plugins qml translations
      [root@localhost Qt5.6_x64]# cd plugins/

    2. enter sqldrivers and check libsqlmysql.so
      [root@localhost plugins]# cd sqldrivers/
      [root@localhost sqldrivers]# ls
      libqsqlmysql.so libqsqlodbc.so libqsqlpsql.so
      [root@localhost sqldrivers]# ldd libqsqlmysql.so

    3. check libmysqlclient lib file on sqldrivers in qt source code

    0_1461041134242_sqlconnect_qt.png



  • 阿尼哈噻哟,老问题了,要么重新编译qt数据库驱动,要么找个匹配的libmysqlclient.so
    坛里的英语达人/韩语达人来解答吧!



  • Well done on your own solution!
    Till now there are less need on libmysql, I think it'll be useful sooner or later.



  • @darongyi 挺好的,
    Windows下怎么就木有自带的类似ldd的命令呢...
    天天看你说的英文,我那渣英文也慢慢变溜了



  • 这么好的东西,我觉得还是放在博客区这样的比较好吧。


Log in to reply
 

走马观花

最近的回复

  • 诶 没有Linux吗??

    read more
  • 萌梦 男孩,女孩,和蛋

    menghome.png

    read more
  • 设计模式-工厂模式

    使用qt/qml来演示设计模式效果,便于学习理解

    1)定义创建对象的接口,封装对象的创建
    2)使具体化类的工作延迟到工厂子类中

    bg.png
    image.png

    1. 工厂类

    createProduct使用了参数来选择要创建哪个产品

    #ifndef FACTORY_H #define FACTORY_H #include <QObject> class Product; class QString; class Factory: public QObject { Q_OBJECT public: virtual ~Factory() = 0; virtual Product* createProduct(QString type) = 0; protected: Factory(); }; class ConcreteFactory: public Factory { Q_OBJECT public: ~ConcreteFactory(); ConcreteFactory(); public slots: Product* createProduct(QString type); }; #endif // FACTORY_H #include "factory.h" #include "product.h" #include <QtQml/qqml.h> Factory::~Factory() { } Factory::Factory() { qmlRegisterType<Product>("Product", 1, 0, "Product"); } ConcreteFactory::~ConcreteFactory() { } ConcreteFactory::ConcreteFactory() { } Product *ConcreteFactory::createProduct(QString type) { if(type == "boy") return static_cast<Product *>(new ConcreteProduct1()); else if(type == "girl") return static_cast<Product *>(new ConcreteProduct2()); return static_cast<Product *>(new ConcreteProduct1()); } 2 产品类

    一个产品是萌梦男,一个产品是萌梦女

    #ifndef PRODUCT_H #define PRODUCT_H #include <QObject> class Product: public QObject { Q_OBJECT public: virtual ~Product() = 0; Q_PROPERTY(QString icon READ icon NOTIFY iconChanged) QString m_icon; QString icon() const { return m_icon; } signals: void iconChanged(QString icon); protected: Product(); signals: public slots: }; class ConcreteProduct1: public Product { Q_OBJECT public: ~ConcreteProduct1(); ConcreteProduct1(); }; class ConcreteProduct2: public Product { Q_OBJECT public: ~ConcreteProduct2(); ConcreteProduct2(); }; #endif // PRODUCT_H #include "product.h" Product::~Product() { } Product::Product() { } ConcreteProduct1::~ConcreteProduct1() { } ConcreteProduct1::ConcreteProduct1() { m_icon = "qrc:/images/boy.png"; } ConcreteProduct2::~ConcreteProduct2() { } ConcreteProduct2::ConcreteProduct2() { m_icon = "qrc:/images/girl.png"; } 3. main.qml

    使用timer,canvas,listview等实现一个自动化生产的动画效果

    源代码

    Fork me on Gitee

    read more
  • blender建模 章鱼
    捕获2.PNG 😵

    read more

关注我们

微博
QQ群