Question: This code works fine:

```
import  MySQLdb

db = MySQLdb.connect("localhost", "root", "","bullsorbit")
cursor = db.cursor()

cursor.execute("Select * from  table  where  conditions'")
numrows = int(cursor.rowcount)

print 'Total number of Pages :  %d ' % numrows

```

but if I give my IP address 

```
db = MySQLdb.connect("192.168.*.*", "root", "","bullsorbit")

```

it will give this error

```
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on 'ip address' (111)")

```

Answer: 
with localhost you connect via loopback-interface.

with ip-addr you connect - as you connect from extern.

if your server allows only the local (loopback) connection
your ip-addr connection fails. (security!)

look at your mysql config, maybe only local-connections are allowed.

is the skip-networking switch off (in the mysql-conf) ?

```
#skip-networking

```
Instead of:

`db = MySQLdb.connect("192.168..", "root", "","bullsorbit")`

try:

`db = MySQLdb.connect(user="root", host="192.168..", db="bullsorbit")`

Password will default to empty string and try the usual identity methods. Host will also default to localhost on default port.