安裝和使用MySQL的過程遇到問題和解決的方法

問題:在powershell下用easy_install來安裝MY-SQL-python無法安裝成功,錯誤信息爲:

            No local packages or download links found for MySQL-python

            error: Could not find suitable distribution for Requirement.parse('MySQL-python')。

解決方法:在http://www.codegood.com/downloads下載MYSQL-python,下載完畢後再用easy_install安裝即可。用 importMySQLdb 測試是否安裝成功。

            在http://dev.mysql.com/downloads/file/?id=458918下載mysql-connector

問題:import mysql.connector:mysql.connector.errors.ProgrammingError: 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

解決方法:鏈接:http://blog.csdn.net/hsg77/article/details/39159191

問題: cursor.execute('select * from user where id = %s', '1'),出現問題mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%s' at line 1。

解決方法:改爲ursor.execute('select * from user where id = 1')
發佈了30 篇原創文章 · 獲贊 7 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章