1. Install MySQL
# sudo apt-get install Mysql-server
The installation process needs to enter the root password, which is the root password of MySQL, then connect to MySQL will be used, this to remember.
After the installation is complete, you can use the following command to check whether the installation was successful.
MySQL--user=root-p
Enter the root password for MySQL. If you can log on successfully, the installation is complete.
2. Installing PYTHON-MYSQLDB
sudo apt-get install Python-mysqldb
This step I encountered 3 questions:
Issue one: Could not find any downloads that satisfy the requirement Mysql-python
Workaround:
Manually download Mysql-python-1.2.5.zip from http://pypi.v2ex.com/simple/mysql-python/. Unzip and then copy to the Linux path.
Then perform the installation using the following command.
# Flask/bin/pip Install mysql-python-1.2.5/
Question two:environmenterror:mysql_config not found
Workaround:
# sudo apt-get install Libmysqlclient-dev
# vim mysql-python-1.2.5/setup_posix.py, change the Mysql_config.path value.
Mysql_config.path = "/usr/bin/mysql_config"
Issue three: _mysql.c:29:20:fatal error:python.h:no such file or directory
Workaround:
# sudo apt-get install Python-dev
Install MySQL under Flask