473,944 Members | 25,296 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

need help with MySQLdb

Hey there all,
i have a question about how to point my python install to my sql
database.

when i enter this: db = MySQLdb.connect (user="user", passwd="pass",
db="myDB")

i get this:
Traceback (most recent call last):
File "<pyshell#1 >", line 1, in -toplevel-
db = MySQLdb.connect (user="user", passwd="pass", db="MyDB")
File "/usr/lib/python2.4/site-packages/MySQLdb/__init__.py", line 66,
in Connect
return Connection(*arg s, **kwargs)
File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py" , line
134, in __init__
super(Connectio n, self).__init__( *args, **kwargs2)
OperationalErro r: (1049, "Unknown database 'MyDB'")

i am using the all in one package from lampp (now xampp) and i have
tested a couple of python scripts from the cgi, but.... nothing that
connects to the database.

any ideas?

thanks

Jul 19 '05 #1
4 2447
ne*****@xit.net wrote:
Hey there all,
i have a question about how to point my python install to my sql
database.

when i enter this: db = MySQLdb.connect (user="user", passwd="pass",
db="myDB")

i get this:
Traceback (most recent call last):
File "<pyshell#1 >", line 1, in -toplevel-
db = MySQLdb.connect (user="user", passwd="pass", db="MyDB")
File "/usr/lib/python2.4/site-packages/MySQLdb/__init__.py", line 66,
in Connect
return Connection(*arg s, **kwargs)
File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py" , line
134, in __init__
super(Connectio n, self).__init__( *args, **kwargs2)
OperationalErro r: (1049, "Unknown database 'MyDB'")

i am using the all in one package from lampp (now xampp) and i have
tested a couple of python scripts from the cgi, but.... nothing that
connects to the database.

any ideas?

thanks

Try the following from the shell (NOT the python shell):
mysql -u user -p
[Enter passwd]
mysql> show databases;

If MyDB isn't in the list either something went wrong with the xampp
installation or the database for xampp got a different name. (I am no
xampp expert, so I can't help you any further)

HTH,
Wolfram
Jul 19 '05 #2
On 29 Jun 2005 21:56:49 -0700, ne*****@xit.net declaimed the following
in comp.lang.pytho n:

any ideas?
Step 1: show us what the interactive command line tool "mysql"
does with...
mysql user -p
pass
use MyDB;

IOW, verify you can connect to the database using the MySQL
tools first, then figure out what is different with the MySQLdb call.

-- =============== =============== =============== =============== == <
wl*****@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
=============== =============== =============== =============== == <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.ne tcom.com/> <

Jul 19 '05 #3
On Thu, 30 Jun 2005 06:47:18 GMT, Dennis Lee Bieber
<wl*****@ix.net com.com> declaimed the following in comp.lang.pytho n:
On 29 Jun 2005 21:56:49 -0700, ne*****@xit.net declaimed the following
in comp.lang.pytho n:

any ideas?
Step 1: show us what the interactive command line tool "mysql"
does with...
mysql user -p
pass
use MyDB;

IOW, verify you can connect to the database using the MySQL
tools first, then figure out what is different with the MySQLdb call.


{okay, slight error in the command line string -- I haven't ported MySQL
from the old W98 machine to the WinXP machine yet}

-- =============== =============== =============== =============== == <
wl*****@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
=============== =============== =============== =============== == <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.ne tcom.com/> <

Jul 19 '05 #4
nephish wrote:
[...]
Try the following from the shell (NOT the python shell):
mysql -u user -p
[Enter passwd]
mysql> show databases;

If MyDB isn't in the list either something went wrong with the xampp
installation or the database for xampp got a different name. (I am no
xampp expert, so I can't help you any further)

HTH,
Wolfram

after i entered the password it told me it cannot connect to mysql through
socket /tmp/mysql.sock

hmmmm.
hope this helps


Please keep the discussion on the list

Try
mysql -u user -p -h 127.0.0.1

HTH,
Wolfram
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2598
by: Peter Nikolaidis | last post by:
Greetings, I am attempting to get MySQLdb 0.9.2 installed on Mac OS 10.2 with a Fink distribution of Python 2.2.2. I have seen only a few posts on the subject, some of them relate to "conflicting header files," but I don't know what to do about conflicting header files, or where I would find them, and once I found them, which ones to remove. I have compiled MySQL 4.1 and installed into /usr/local/mysql, but since have moved to a Fink...
1
1570
by: Michael | last post by:
Is there a mailing list or anything like that for users of the MySQLdb module? Using version 0.9.2 with Python 2.3.2 and whenever I try to open a connection I get this error: File "/home/webserver/localhost/dvdlookup/MyMySQL.py", line 23, in _connect passwd = self.password, db = self.db ) File
0
1499
by: Stephen Roderick | last post by:
Getting weird error, and I was wondering if anyone had any suggestions. My system appears to satisfy all MySQLdb prerequisities in terms of python, mysql, etc. Also, phpMyAdmin works fine with mysql, leading me to believe that my installation of MySQLdb is at fault. Any ideas? TIA For file test1.py (for appropriate values of user and passwd, and database location exists)
0
1483
by: Wesley Kincaid | last post by:
I'm attempting to run a simple query through MySQLdb's cursor.execute(). However, when the request includes a timestamp field, I'm getting "ValueError: invalid literal for int(): 9-." Could someone please explain what I'm doing wrong? The table is served off of MySQL 4.0.20 and contains the following fields:
2
2206
by: ws Wang | last post by:
MySQLdb is working fine at command line, however when I tried to use it with mod_python, it give me a "server not initialized" error. This is working fine: ----------------------- testmy.py ------------------------------- #!/usr/bin/python import MySQLdb db = MySQLdb.connect(host="localhost", user="root", passwd="mypass", db="my_db") cursor = db.cursor()
2
1221
by: nephish | last post by:
Hey there, does anyone know where i can find some real documentation on the MySQLdb module? This thing is driving me nuts. all i can find on the internet is some brief tutorials. I need to know whats up with some of my stuff i even bought Programming Python by O'Reilly, out of over 1200 pages, and it only has a page or two dedicated to it. eeek. Thanks. <><
2
4527
by: Mondal | last post by:
Hi, I am using MySQL 5.0 beta and Active Python 2.4. I have the correct version of MySQLdb installed. The problem is that I can't connect to MySQL through the Active Python interactive window. Here is a sample error: >>> c=MySQLdb.Connect(host='localhost',user='root',passwd='',db='shop',port=3306) Traceback (most recent call last):
4
1470
by: elmo | last post by:
Hello, after two days of failed efforts and googling, I thought I had better seek advice or observations from the experts. I would be grateful for any input. We have various small internal web applications that use utf-8 pages for storing, searching and retrieving user input. They have worked fine for years with non ASCII values, including Russian, Greek and lots of accented characters. They still do on an old version of python (2.2.1),...
0
1932
by: jgarber | last post by:
Hello, I just upgraded MySQLdb to the 1.2.0 version provided by Redhat Enterprise Linux ES4. At that point I began to get segfaults when importing twisted after MySQLdb, but not before. -- RedHat Enterprise Linux ES 4 (fully updated) Python 2.3.4 mysql-python (MySQLdb) version 1.2.0
0
10147
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
11310
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10677
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9870
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8238
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3520
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.