Questions tagged [mysql-python]

Use this tag for questions about the MySQL-Python database connector library (MySQLdb). Do not use this tag for questions about MySQL Connector/Python (use the [mysql-connector-python] tag instead).

MySQL-Python, also known as MySQLdb, is a database connector library that implements the Python Database API.

This tag should be used to identify questions related to:

  • Installing the MySQL-Python library;
  • Using the library to connect to a MySQL database from a Python interpreter or script;
  • Specific implementation details of the library; e.g., thread safety, error messages, cursor behavior.

This tag should not be confused with:

The MySQL-Python project is hosted on Sourceforge; however, as of September 2014, a newer package than the one found on Sourceforge (v1.2.4b4) is available from the Python Package Index (v1.2.5).

Andy Dustman (user profile on stackoverflow) has written a detailed User's Guide and maintains a code repository for the project on github.

3186 questions
0
votes
2 answers

MySQLdb Unknown MySQL server host

I have python 2.7 installed. I have wamp running. I have MySQL running on 10127 port. I have root set up with no password i have (unrelated) php code running that connects fine with the call mysql_connect('localhost:10127', 'root', ''); when i…
arhud
  • 69
  • 1
  • 9
0
votes
1 answer

Connecting to MySQL with Python in Ubuntu (Weird Error)

I'm using ubuntu 10.10, and after making the mistake of installing LAMP, (was unable to connect to a database with it), I came here and read how important it is to use apt-get install python-mysqldb instead. Deleted LAMP, re-installed using apt-get,…
rabunc
  • 67
  • 5
0
votes
1 answer

MySQLdb Python - does my code look correct?

c.execute("""DELETE FROM data WHERE user = %s AND machine = %s""" , (user, machine)) I have two variables that were sent with get (technically they were machine+user, and then I split the variable based on the plus), who were then respectively…
Steven Matthews
  • 9,705
  • 45
  • 126
  • 232
0
votes
1 answer

Something wrong with Mysqldb for python on mac

Hi I'm trying to install mysqldb for python on a mac and below is the trace. Can anyone help? >>> import MySQLdb /Library/Python/2.6/site-packages/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg/_mysql.py:3: UserWarning: Module _mysql was already…
locoboy
  • 38,002
  • 70
  • 184
  • 260
0
votes
1 answer

python 2.x and mysqldb 5: how to ignore all characters in a string

I am currently working on a python script that pulls data from a table on databaseA, and puts all that data into databaseB, which is not located near databaseA. when calling an insert into databaseB I get an error from the mysqldb module 1064: You…
helmet648
  • 53
  • 2
  • 11
0
votes
1 answer

Python Error checking using pymysql get errors

I have put together an example python scripts for myself to understand how to connect to a MySQL database using pymysql. It works but in Thonny-Assistant it is showing a few errors and I am asking for help to understand these errors to see if they…
0
votes
0 answers

Trying to insert collection from mongodb to mysql table

mongodb contains 2 collection with 5 fields each: { "channel details": c, "playlist details": p, "video_ids": v_id, "video details": v, "comment details" I am trying to push each field in a separate table in MySQL. e.g. all…
0
votes
0 answers

Lost connection to MySQL server during query - Can't connect to MySQL Server

I am trying to access new, fresh MySQL Server over corporate network, machines are using Windows. MySQL running version 8.0, python is 3.9.13 My code (Variant 1 pymysql) import pymysql def test_mysql_connection(host, port, username, password): …
directx995
  • 11
  • 2
0
votes
0 answers

Discord Python Bot - sending bot userID instead of client userID?

As title suggest, I have a bot that basically accepts 3 ints via command and stores them in a database by username and user id. i'm now trying to make a command that lets the user recall the information they submitted. however, when I run the code,…
racin36er
  • 3
  • 1
0
votes
1 answer

backup mysql database like mysqldump with python not from server but from client

I finished my big project in python which is in short a GUI to administrate a database. The datas stored in the database are really important and i want to be sure that if the server stop functionning i'll still have a backup of the database. The…
0
votes
1 answer

Why did my Python script abort within a try block?

My script has been running continuously for about a week. Received this error and the script aborted: Traceback (most recent call last): File "/opt/dba/home/swechsler/library/mysql/bin/./kill_duplicate_processes", line 208, in
Swechsler
  • 101
  • 3
0
votes
0 answers

Select from a table and insert in another table with different order

With following query I retrieve some names from a table query = "SELECT lastname FROM `firsttable` WHERE grp = 'C' AND av = '0' " Caleb Collins Fiandre Francis Garmont Gavelot Maxima Power Zanzibar Zavinsly Saccult Stancovich Pedrocet then these…
Ryan Day
  • 113
  • 1
  • 8
0
votes
1 answer

Django ImportError: dlopen(_mysql.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_mysql_affected_rows'

I am setting up local workspace for my Django project with MySQL on a Macbook AIR with M2 chip. All config are migrated from my old Macbook Pro with core i7 using OSX Migration Assistant. I am having problem trying to run server on my local, i.e.…
black zeng
  • 135
  • 1
  • 13
0
votes
1 answer

python mysql.connecotr raise InternalError("Unread result found")

With: pip install mysql-connector-python import mysql.connector I have a db with millions of rows, so the fetchall() method was causing some memory issues. db_cursor.execute(sql_query, sql_values) for row in…
64rl0
  • 29
  • 5
1 2 3
99
100