Python Learning notes-using the database (i)

Source: Internet
Author: User

1. CentOS7 Install MySQL

# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

# RPM-IVH mysql-community-release-el7-5.noarch.rpm

# yum Install Mysql-community-server

Restart MySQL Service

# Service Mysqld Restart

The initial installation of the Mysql,root account has no password.

# mysql-u Root

Set password//Can not

mysql> set password for ' root ' @ ' localhost ' =password (' password ');

MySQL config file is/etc/my.cnf

Finally add the encoding configuration

[MySQL]

Default-character-set =utf8

Remote connection Settings

Mysql> Grant all privileges on * * to [e-mail protected] '% ' identified by ' password ';

2. Installing the Mysql-python module      1.1 Effects

Python operation MySQL requires Mysql-python module driver.

1.2 Installing Mysql-python

1): https://pypi.python.org/pypi/MySQL-python/

2) Unzip:

#unzip Mysql-python-1.2.5.zip

3) Enter the file:

#cd mysql-python-1.2.5

4) #yum-y install Mysql-devel

5) #yum Install GCC Python-devel

6) #python setup.py Install

7) Installation success, test:

#python

>>>import MySQLdb

Python Learning notes-using the database (i)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.