Justifying Non-Standard Python 3 MySQL Connector Use - mysql

I am creating a project using Django + Python 3.4. However, according to this question, the standard MySQL connector for Python does not support the language's third release (which I'm having a difficult time believing, but that's beside the point).
Ultimately, my question is whether or not it is justifiable to use a non-standard connector fork (such as that which is presented in the linked question above) over downgrading to Python 2.x. For example, are there any significant security issues with using the forked connector instead of waiting for an official release?

MySQL Connector/Python is not bundled with Django, but it is made by Oracle. So I'm not sure if it should be considered an unofficial fork.
I'm using it with an old mySQL database, python 3.4 and django 1.7. The only problem I've noticed is that sometimes the error messages are a bit wonky.
Installation is very easy:
pip install mysql-connector-python --allow-external mysql-connector-python

I have been using the mysql-connector-python connector for several months without issue. This is using Python 3.4.2 and Django-1.7.1.
It actually works much better than the git fork someone else did of the python 2 connector.
My opinion, don't downgrade to python 2 - This is a solid connector in my experience.

Related

General Requirements for EF Core Versus Pomelo.EntityFrameworkCore.MySql

I am confused about several things to configure mysql with entity framework.
I saw the mysql documentation and they say i have to install MySql.EntityFrameworkCore 6.0.x and the connector/net, but, in some projects and videos i watched they just install Pomelo.EntityFrameworkCore.MySql.
So, my question is, can i install Pomelo.EntityFrameworkCore.Mysql and omit the instalation of Mysql.EntityFramework and the connector (connector/net)?
Thanks a lot in advanced!
I tried to understand this by my own but, i can not find information about that.

Mysql Connector 8.0 and Python 3.8

I am using Windows 10. I have python 3.8.2 32 bit installed. I am trying to use mysql-installer-web-community-8.0.20.0.msi the connector for Python. The connectors are grayed out and not available. The error message says Python 32-bit not installed. I see old threads claiming you need Python 3.4. The documentation here: https://dev.mysql.com/doc/connector-python/en/connector-python-versions.html claims this will work with Python 3.8.2. Do I need a different MySql installer? If not, what am I doing wrong?
Thanks,
Scott
I am not sure why I was using the MySQL installer to install libraries for Python. In hind-sight, that doesn't make sense. Use pip to install the drivers like
$ pip install mysql-connector-python
# or
$ python pip install mysql-connector
# or for >= Python 3.9
$ pip install mysqlclient
It is not entirely clear what the difference is, but, the first of the three solved the problem.
I faced similar issue while working with MySQL 8.0.18 with Python 3.8 on Windows 10 64 Bit Machine.
And I used the following workaround -
Ensured that all the installers used were 64-Bits installers for My SQL and Python since my machine is Windows 10 64-bit machine.
Ensured that Python Connector for MySQL supported the corresponding python version from https://insidemysql.com/category/mysql-development/connectors/python/ Incase of issues or lack of information downgraded MySql by minor version.
Downloaded independent MSI for Connector from - dev.mysql.com/downloads
Manually installed the downloaded Connector MSI.
Hopefully this information will help you troubleshoot your issue as well by using corresponding 32-bit versions.
If your CPU architecture is 64 bit then be sure that you download MySQL Connector 64 bit version. 32 bit installers would also work but sometimes occurs minor errors. Also MySQL Connector Python requires Python to be in the system’s PATH. Installation fails if python cannot be located. Add python.exe path to System PATH varible. So that MySQL connector can find the execution file.
It is sadly known that MYSQL has low compatibility with python.
For example, I have stepped into this issue while trying to install mysql-python (a terrible one!) and this other issue while using mysqlclient.
There are a lot of python connectors for mysql, you can try some and see one by one if they work. I would recommend pymysql.
However, I would recommend you to use a Postgresql db with python, it really works like charm, and if you want to have a local DBMS/GUI/workbench to work on it, you can use PgAdmin.
I am not sure why I was using the MySQL installer to install libraries for Python. In hind-sight, that doesn't make sense. Use pip to install the drivers like
$ pip install mysql-connector-python
# or
$ python pip install mysql-connector
It is not entirely clear what the difference is, but, the first of the two solved the problem.
Adarsh

Mysql Cookbook error RecipeNotFound: could not find recipe client for cookbook mysql

I'm trying to provision a server with a Chef project that relied on an older version of the mysql cookbook (5.6.3). As this particular version is not compatible with anything newer that Ubuntu 14.04, I tried updating to the latest version (8.5.1) which lead to the same error. I understand that the mysql cookbook no longer provides recipes and is supposed to be a library only cookbook but it's really not clear how I'm supposed to edit the code to do what the older version did. Is there any other cookbook built on top of this one to simply install mysql client and server like the old version did or do I have to write a wrapper cookbook like the documentation seems to suggest?
You have to write a wrapper cookbook now. The community cookbook only provides resources that you then use from that wrapper cookbook.
You can write your own cookbook to install the specific version of mysql. You can use package chef resource
You can create a template(my.cnf.erb) for the my.cnf file and copy it over the default using the template chef resource

mysql installer fails to recognize python 3.4

I'm trying to istall mysql server on a windows 7 machine - that has python 3.4.3 installed. However, when trying to install the python connectors for 3.4, the installer fails to recognize the python installation, saying python 3.4 is not installed.
Has anyone solved this issue before? I'ts driving me nuts...
Just to add to the murkiness, I had the same error with current version of MySql install when attempting with python 3.5 installed (which is the latest python download). Long story short, I uninstalled python 3.5, installed python 3.4.4 (which interestingly didn't update PATH so I updated it manually) and reran installer and it found the python installation.
So my conclusion is the MySql installer is tied to certain versions of the add-on products which in this case meant specifically python 3.4
just in case anyone else has this issue in future. Look at what bit version you have for Python 3.4. When I installed 64 bit version of Python 3.4, this issue went away.
I ran into a similar issue with Python 3.7.2.
In my case, the problem was that I tried to install the 64 bit MySQL connector, but had the 32 bit version of Python installed on my machine.
I got a similar error message:
Python v3.7 not found. We only support Python installed using the Microsoft Windows Installer (MSI) [...]
The problem just went away by installing the 32 bit MySQL connector instead.
From my experience if you have both Py2.7 and Py3.4 installed when installing the mysql connector for py3.4 you will run into this issue. Not sure of the WHY but for some reason if you have py2.7 installed, the py3.4 mysql connector recognizes that version first and just assumes that you have py2.7 installed and does not recognize that py3.4 is installed.
The only way I have found around this is to uninstall py2.7 and then install the py3.4 mysql connector. You can always install py2.7 again after the fact.
I had 3.6.X version and it could not see it; I uninstalled it and installed 3.4.0 version and it passed the requirement.
https://www.python.org/downloads/release/python-340/
Had the same problem and have fixed it. Using a Windows 7 PC and I already had multiple versions of Python installed.
Uninstalled all versions of Python from my PC
Uninstalled the failed MySQL install
Restarted PC
Re-installed Python 3.7 64-bit (the currently required version for MySQL)
Installed the Python 3.7 MySQL Connector separately through the link below
https://dev.mysql.com/downloads/connector/python/
Once that was installed, restarted the MySQL install
The MySQL Installer window will open and already show the Python 3.7 MySQL Connector in the list of products
Click "Add" at the top-right and select all of the products you want and then install them
You should then be able to complete the MySQL setup
I was looking for an similar answer. The correct answer is that there is a bug in the mysqlconnector MSI. When python installs, it creates a registry entry under HKLM Software\Python\PythonCore\3.6-32\InstallPath however, the MSI for mysqlconnector is looking for installation path in the registry Software\Python\PythonCore\3.6\InstallPath as part of the RegLocator/registrypath variable.
Use ORCA to edit the MSI, change the RegLocator so that -32 is in the path. It will install now without error or changes to the system.
I had same problem with python 3.4, all I did was installed python 3.4 version for all users. and added system variable as per this page. it worked for me!
Hope that helps.
Make sure you have the 64bit version of whichever version of Python you are running. It can be downloaded from here:
https://www.python.org/downloads/windows/
Just had the same problem and this solved it for me. I also uninstalled all previous versions of Python before running the mysql setup
I had this problem until I discovered I had installed python based in another architecture (32b). MySQL required 64 bit.
Had the same problem with Python 3.7 when trying to install MySQL in Windows 10. It was fixed by installing the 64-bits version of Python, not selected by default when going to https://www.python.org/downloads/.
I found it in https://www.python.org/ftp/python/3.7.3/python-3.7.3-amd64.exe
Here is a much simpler work around:
pip install mysql-connector-python
Is the same package that MySQL is having trouble installing. Just use pip to install it.
Next, go back to the installation style and select "Manual" instead of "Developer". They are identical, but "Manual" allows you to remove packages. Just remove the "Connector/Python" package from the list to be installed.
Carry on with the install, you're done.

using mysql in lua script

I need to read a database table from inside a Lua script in pdns-recursor on a Scientific Linux 6.4 server which comes with Lua pre-loaded.
Apparently I have to use luarocks to install luasql. When I attempt to install luasql I get:
Checking Lua includes... lua.h not found
lua.h is not on the server.
I tried removing the installed version so I could install from binary but then that trashed the system which apparently uses the installed Lua for everything (yum, rpm, etc). Now I have to reload OS. How can I get MySQL access from embedded Lua?
Thanks in advance.
I assume that you have already checked yum to see if luasql is available through that; if not, you should first do that, and install it through yum if possible.
The immediate cause of the problem you're having is that luarocks automatically builds modules from source, which requires access to the lua headers. These are not needed simply to run programs that use Lua, so they are not installed as part of the normal Lua package. I'm not familiar with Scientific Linux, but you can probably get them by installing a package named lua-dev, lua-devel, lua-headers, or some variant thereof. You may also need the mySQL packages (both the libraries proper and the headers). Once you have those installed, give it another try.
You might also try LuaDist, which I find to be generally more polished than luarocks, and capable of automatically downloading more dependencies; in particular it probably will not require the lua headers installed, and can handle automatically downloading and installing lua itself from source. It does, however, require CMake installed.
If for some reason you can't install the required headers and can't get luarocks or luadist working, you can try downloading and building luaSQL by hand. The Lua headers can be found in the Lua 5.1 source package and LuaSQL 2.2. Assuming the Scientific Linux maintainers haven't excessively customized the version of lua they ship with it, the results should be compatible with the system Lua install.