PyMySql

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

PyMySql

Postby macloo » 25. February 2018 01:47

Using the non-VM version of XAMPP in the past, I could run this script from Documents/python on my Mac (with all XAMPP services running) and it worked.

Code: Select all
import pymysql.cursors

# connect to the local database
conn = pymysql.connect(host='localhost',
                    port=8080,
                    unix_socket='/tmp/mysql.sock',
                    user='root',
                    password=None,
                    db='dbname',
                    charset='utf8',
                    cursorclass=pymysql.cursors.DictCursor)


Now with the VM version of XAMPP, I cannot figure out how to get it working. I hope someone has a solution.
macloo
 
Posts: 4
Joined: 16. January 2018 16:09
XAMPP version: 7.2.0-0
Operating System: OSX

Re: PyMySql

Postby Nobbie » 25. February 2018 11:22

Python is not part of Xampp (neither VM nor non-VM); your Python Interpreter must have been part of OSX installation. The Xampp-VM lacks of course Python, as it is not embedded in your OSX.
Nobbie
 
Posts: 10155
Joined: 09. March 2008 13:04

Re: PyMySql

Postby macloo » 25. February 2018 13:27

I know Python is not part of my XAMPP-VM, and yes, I am running Python on Mac OS. My question was perhaps not clear enough.

I am trying to find out how to communicate with the VM from the rest of my system. Is there a way to do that? Or is the VM sealed off from the rest of my system?

I recognize that it is separate, but isn't there some way to address the server on /opt/lampp/ with a script running in /Users/myname/Documents/python/ ?
Last edited by macloo on 25. February 2018 13:36, edited 1 time in total.
macloo
 
Posts: 4
Joined: 16. January 2018 16:09
XAMPP version: 7.2.0-0
Operating System: OSX

Re: PyMySql

Postby macloo » 25. February 2018 13:36

I've changed my script to this, and still, no luck.

Code: Select all
conn = pymysql.connect(host='192.168.64.2',
                    port=8080,
                    unix_socket='/opt/lampp/var/mysql/mysql.sock',
                    user='root',
                    password=None,
                    db='dbname',
                    charset='utf8',
                    cursorclass=pymysql.cursors.DictCursor)
macloo
 
Posts: 4
Joined: 16. January 2018 16:09
XAMPP version: 7.2.0-0
Operating System: OSX

Re: PyMySql

Postby Nobbie » 25. February 2018 20:17

macloo wrote:I am trying to find out how to communicate with the VM from the rest of my system. Is there a way to do that?


You cannot, thats impossible.

macloo wrote:Or is the VM sealed off from the rest of my system?


Exactly. Its like a different PC in your LAN.
Nobbie
 
Posts: 10155
Joined: 09. March 2008 13:04


Return to XAMPP for Mac OS X

Who is online

Users browsing this forum: No registered users and 2 guests