Install MySQL under Flask

Source: Internet
Author: User

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

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.