Under Root access
Apt-get Install Mysql-serverapt-get Install mysql-client
Create a database
Mysql-u root-p passward linked databases CREATE DATABASE Basenameuse basename
If the database exists to be changed, it can be used directly
Mysql-u root-p Passward basename
Create a table
CREATE TABLE latest_face (ID int (one) not NULL auto_increment, camera_id varchar (+) NOT null, picture Mediumblob NOT NULL , datetime datetime NOT NULL, people_id int (one) not NULL, People_name varchar (+), accessed int (4) Not null,primary key (ID) ) charset = gb2312;
Link the database with Python.
When using Apt-get install Mysql-python, you will be prompted not to find the package Mysql-python. But the direct download and installation is very troublesome, so use pip install Mysql-python
When using PIP install Mysql-python, prompt environmenterror:mysql_config not found. At this point reinstall Libmysqlclient-dev,pt-get Install Libmysqlclient-dev, then pip install Mysql-python. The installation was successful.
Enter import mysqldb under Python to test whether you can use the
The above is a small series to introduce you to the Ubuntu system Python link MySQL database method, I hope we have some help, if you have any questions please give me a message, small series will promptly reply to you. Thank you very much for your support for topic.alibabacloud.com!