解决安装mysqlclient出现问题:mysql_config: not found

Posted 时间@煮雨~

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决安装mysqlclient出现问题:mysql_config: not found相关的知识,希望对你有一定的参考价值。

解决安装mysqlclient出现如下问题:

Complete output from command python setup.py egg_info:
    /bin/sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-7qo1k7as/mysqlclient/setup.py", line 18, in <module>
        metadata, options = get_config()
      File "/tmp/pip-install-7qo1k7as/mysqlclient/setup_posix.py", line 53, in get_config
        libs = mysql_config("libs_r")
      File "/tmp/pip-install-7qo1k7as/mysqlclient/setup_posix.py", line 28, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    OSError: mysql_config not found
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-7qo1k7as/mysqlclient/

 


安装mysql:

sudo apt-get install mysql-server mysql-client
然后mysql -V查看mysql是否安装成功
sudo  apt-get install libmysqlclient-dev python3-dev
然后
pip install mysqlclient就不会报错找不到\'mysql_config\'了


# mysql5.7创建用户并授权:
创建数据库



 mysql> CREATE USER \'office\'@\'%\' IDENTIFIED BY \'office\';

 mysql> CREATE DATABASE office DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
 
 mysql> grant all privileges on office.* to office@\'%\' identified by \'office\';

 mysql> flush privileges;


修改密码:
set password for root@\'localhost\'=password(\'xxxx\');
注意@\'localhost不能省略

```

本文主要摘自:https://www.cnblogs.com/lajiao/p/9176060.html

以上是关于解决安装mysqlclient出现问题:mysql_config: not found的主要内容,如果未能解决你的问题,请参考以下文章

mac 安装 python mysqlclient 遇到的问题及解决方法

mac 安装 python mysqlclient 遇到的问题及解决方法

Django报错“Did you install mysqlclient or MySQL-python?”的解决办法(前提:mysqlclient&MySQL都已经安装)

安装后出现错误mysqlclient not install?

python安装mysqlclient模块时报mysql_config not found解决方法

mac 解决mysqlclient安装失败问题