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)