• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >python > ubuntu系统下 python链接mysql数据库的方法

ubuntu系统下 python链接mysql数据库的方法

作者: 字体:[增加 减小] 来源:互联网

通过本文主要向大家介绍了ubuntu python mysql,ubuntu安装python2.7,ubuntu安装python3,ubuntu安装python3.5,ubuntu下安装python等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

进入root 权限下

apt-get install mysql-server
apt-get install mysql-client
</div>

创建数据库

mysql -u root -p passward 链接数据库
create database basename
use basename
</div>

如果数据库存在要进行改动可以直接使用

mysql -u root -p passward basename
</div>

创建表

create table latest_face( id int(11) not null auto_increment, camera_id varchar(240) not null, picture mediumblob not null, datetime datetime not null, people_id int(11) not null, people_name varchar(16),accessed int(4) not null,primary key(id) )charset = gb2312;
</div>

用python链接数据库。

当使用apt-get install mysql-python 的时候,会提示未发现软件包mysql-python。但是直接下载再安装又非常麻烦,所以使用了pip install mysql-python

在使用pip install mysql-python的时候,提示EnvironmentError: mysql_config not found。此时重装libmysqlclient-dev,pt-get install libmysqlclient-dev,然后pip install mysql-python.就安装成功了

在python下输入import MySQLdb测试是否可以使用

以上所述是小编给大家介绍的ubuntu系统下 python链接mysql数据库的方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!

</div>

您可能想查找下面的文章:

  • ubuntu系统下 python链接mysql数据库的方法
  • ubuntu系统下 python链接mysql数据库的方法

相关文章

  • python中__call__内置函数用法实例
  • python在多玩图片上下载妹子图的实现代码
  • Python实现列表转换成字典数据结构的方法
  • 有关wxpython pyqt内存占用问题分析
  • Python中正则表达式的用法实例汇总
  • python实现的二叉树算法和kmp算法实例
  • Unicode和Python的中文处理
  • Windows下使Python2.x版本的解释器与3.x共存的方法
  • Python连接MySQL并使用fetchall()方法过滤特殊字符
  • python实现360的字符显示界面

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • Python中getattr函数和hasattr函数作用详解
    • python中常用的九种预处理方法分享
    • Python的shutil模块中文件的复制操作函数详解
    • 简单介绍Python中的JSON模块
    • 基python实现多线程网页爬虫
    • python实现斐波那契递归函数的方法
    • python用来获得图片exif信息的库实例分析
    • Python的时间模块datetime详解
    • Python程序设计入门(5)类的使用简介
    • Python中的条件判断语句基础学习教程

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有