开发者

In python, is there a simple way to connect to a mysql database that doesn't require root access?

开发者 https://www.devze.com 2023-01-03 06:09 出处:网络
I\'m writing a script to parse some text files, and insert the data that they contain into a mysql database. I don\'t have root access on the server that this script will run on. I\'v开发者_如何转开发

I'm writing a script to parse some text files, and insert the data that they contain into a mysql database. I don't have root access on the server that this script will run on. I'v开发者_如何转开发e been looking at mysql-python, but it requires a bunch of dependencies that I don't have available. Is there a simpler way to do this?


I would recommend the MySQL Python Connector, a MySQL DB-API adapter that does not use the C client library but rather reimplements the MySQL protocol completely in pure Python (compatible with Python 2.5 to 2.7, as well a 3.1).

To install C-coded extensions to Python you generally need root access (though the server you're using might have arranged things differently, that's not all that likely). But with a pure Python solution you can simply upload the modules in question (e.g. those from the Connector I recommend) just as you're uploading those you write yourself, which (if you of course do have a valid userid and password for that MySQL database!-) might solve it for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号