Home Database Mysql Tutorial Mac osx 10.10系统下MySQL

Mac osx 10.10系统下MySQL

Jun 07, 2016 pm 03:46 PM
mac mysql system

在装完MySQL和Navicat之后我以为所有困难都过去了,下个包跑一下setup.py,Python就该乖乖听我的连数据库了……我错了 现在虽然配好了,说实话脑子还是很混乱,不知道到底哪些是有效操作,总之都先写上 ① 下载MySQLdb,此时此刻下到的最新版是MySQL-python-

在装完MySQL和Navicat之后我以为所有困难都过去了,下个包跑一下setup.py,Python就该乖乖听我的连数据库了……我错了

现在虽然配好了,说实话脑子还是很混乱,不知道到底哪些是有效操作,总之都先写上


① 下载MySQLdb,此时此刻下到的最新版是MySQL-python-1.2.5.zip

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


② 解压,修改里面的site.cfg文件,把mysql_config注释去掉,路径改成/usr/local/mysql/bin/mysql_config(←如果mysql是默认安装位置的话)

Mac osx 10.10系统下MySQL

③ 此时运行sudo python setup.py install或者build报了个error: command 'cc' failed with exit status 1 ,如下图所示

Mac osx 10.10系统下MySQL

④ 我在网上找到的解决办法都飒爽地这么回答:

<code><span><span><span>export CFLAGS</span></span><span><span>=-</span></span><span><span>Qunused</span></span><span><span>-</span></span><span><span>arguments
export CPPFLAGS</span></span><span><span>=-</span></span><span><span>Qunused</span></span><span><span>-</span></span><span><span>arguments</span></span></span></code>
Copy after login
然后就是一个pip命令……我没装啊亲QAQ

不过还是把这两行加到了那个传说中的~/.bash_profile文件,也不知道这样做对不对

Mac osx 10.10系统下MySQL

④ 仍然各种报错。

包括还是cc有问题,找不到mysql_config,Reason: image not found,easy_install下载文件是None之类的

于是我把所有参考的文章里的方法都试了个遍,操作了以下4条

<span style="font-size:18px;">sudo n -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/</span>
Copy after login

终于成功……虽然报了很多warning

Mac osx 10.10系统下MySQL

Mac osx 10.10系统下MySQL


总而言之即使配置成功了我也仍旧稀里糊涂的。



感谢以下文章给出的解决方案:

MAC OSX使用Python安装模块问题
http://www.sjsjw.com/kf_other/article/031003ABA007824.asp
MAC安装MySQLdb for Python
http://myuka.blog.163.com/blog/static/174987509201382223549780/
mac os x 10.8 安装python-mysqldb血泪史
http://blog.csdn.net/intel80586/article/details/8487682
Mac os 10.9 Python MySQLdb
http://blog.sina.com.cn/s/blog_60b45f230101mvym.html


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Huawei's Qiankun ADS3.0 intelligent driving system will be launched in August and will be launched on Xiangjie S9 for the first time Huawei's Qiankun ADS3.0 intelligent driving system will be launched in August and will be launched on Xiangjie S9 for the first time Jul 30, 2024 pm 02:17 PM

On July 29, at the roll-off ceremony of AITO Wenjie's 400,000th new car, Yu Chengdong, Huawei's Managing Director, Chairman of Terminal BG, and Chairman of Smart Car Solutions BU, attended and delivered a speech and announced that Wenjie series models will be launched this year In August, Huawei Qiankun ADS 3.0 version was launched, and it is planned to successively push upgrades from August to September. The Xiangjie S9, which will be released on August 6, will debut Huawei’s ADS3.0 intelligent driving system. With the assistance of lidar, Huawei Qiankun ADS3.0 version will greatly improve its intelligent driving capabilities, have end-to-end integrated capabilities, and adopt a new end-to-end architecture of GOD (general obstacle identification)/PDP (predictive decision-making and control) , providing the NCA function of smart driving from parking space to parking space, and upgrading CAS3.0

How to use MySQL backup and restore in PHP? How to use MySQL backup and restore in PHP? Jun 03, 2024 pm 12:19 PM

Backing up and restoring a MySQL database in PHP can be achieved by following these steps: Back up the database: Use the mysqldump command to dump the database into a SQL file. Restore database: Use the mysql command to restore the database from SQL files.

How to optimize MySQL query performance in PHP? How to optimize MySQL query performance in PHP? Jun 03, 2024 pm 08:11 PM

MySQL query performance can be optimized by building indexes that reduce lookup time from linear complexity to logarithmic complexity. Use PreparedStatements to prevent SQL injection and improve query performance. Limit query results and reduce the amount of data processed by the server. Optimize join queries, including using appropriate join types, creating indexes, and considering using subqueries. Analyze queries to identify bottlenecks; use caching to reduce database load; optimize PHP code to minimize overhead.

Always new! Huawei Mate60 series upgrades to HarmonyOS 4.2: AI cloud enhancement, Xiaoyi Dialect is so easy to use Always new! Huawei Mate60 series upgrades to HarmonyOS 4.2: AI cloud enhancement, Xiaoyi Dialect is so easy to use Jun 02, 2024 pm 02:58 PM

On April 11, Huawei officially announced the HarmonyOS 4.2 100-machine upgrade plan for the first time. This time, more than 180 devices will participate in the upgrade, covering mobile phones, tablets, watches, headphones, smart screens and other devices. In the past month, with the steady progress of the HarmonyOS4.2 100-machine upgrade plan, many popular models including Huawei Pocket2, Huawei MateX5 series, nova12 series, Huawei Pura series, etc. have also started to upgrade and adapt, which means that there will be More Huawei model users can enjoy the common and often new experience brought by HarmonyOS. Judging from user feedback, the experience of Huawei Mate60 series models has improved in all aspects after upgrading HarmonyOS4.2. Especially Huawei M

How to insert data into a MySQL table using PHP? How to insert data into a MySQL table using PHP? Jun 02, 2024 pm 02:26 PM

How to insert data into MySQL table? Connect to the database: Use mysqli to establish a connection to the database. Prepare the SQL query: Write an INSERT statement to specify the columns and values ​​to be inserted. Execute query: Use the query() method to execute the insertion query. If successful, a confirmation message will be output.

How to create a MySQL table using PHP? How to create a MySQL table using PHP? Jun 04, 2024 pm 01:57 PM

Creating a MySQL table using PHP requires the following steps: Connect to the database. Create the database if it does not exist. Select a database. Create table. Execute the query. Close the connection.

How to use MySQL stored procedures in PHP? How to use MySQL stored procedures in PHP? Jun 02, 2024 pm 02:13 PM

To use MySQL stored procedures in PHP: Use PDO or the MySQLi extension to connect to a MySQL database. Prepare the statement to call the stored procedure. Execute the stored procedure. Process the result set (if the stored procedure returns results). Close the database connection.

Apple iPhone 16 is no longer pre-installed with Apple Intelligence Apple iPhone 16 is no longer pre-installed with Apple Intelligence Jul 30, 2024 pm 01:18 PM

According to industry insider Mark Gurman, Apple’s Apple Intelligence will be postponed to October. In other words, it will be pushed first on iOS18.1. Apple iPhone 16 is expected to be released in September, so Apple Intelligence will not be pre-installed. 1. Apple Intelligence Apple Intelligence is a personal intelligence system that uses a powerful generative model to provide new functions for iPhone, iPad and Mac to assist users in communicating, working and expressing. 2. Natural language understanding The large model embedded in Apple Intelligence has a deep understanding of the meaning of language.

See all articles