Downloading it from https://dev.mysql.com/downloads/installer/ , going for the web community installation, developer set-up.
Also ended up installing Microsoft Visual C++
Ran into problems where it expected Python 3.4 to be installed, and did not recognise Python 3.6
Installed Python 3.4 from an old download on another computer
On the Python website, 3.4 was as a GZIP, with the script needed to install Python 3.4 as a .sln file which had to be run by MS Visual C++/Studio. I knew this was installed, but I couldn't work out how to open the file using MS Visual C++ - at this point I decided it wasn't worth it.
Setting up this stuff can be painful.
After staring blankly at MySQL workbench, I went back to Google and checked out alternatives to MySQL. Settled on SQLite3.
Downloaded SQLite from https://sqlite.org/download.html
There is no actual installation - simply placing the downloaded files in a suitable folder on your drive - not C:\Program Files - I found that you need to run Python as Administrator to create in/write to folders in Program Files, and I can't be bothered with that.
So now the files are sitting in C:\sqlite\, with an extra folder at C:\sqlite\db\ and it seems okay.
The module you need to import into Python scripts is sqlite3, which is already built into recent Python versions.
I actually got a lot of help from http://www.sqlitetutorial.net/download-install-sqlite/
Although it talks about getting the GUI version, at the moment I will stick with the command-line version just to keep it as simple as possible.
There was also a first Python script to connect to a database, creating one if it doesn't already exist. I modified only the path to find the db file.
And it seems to work as intended (once I got the path right...).import sqlite3
from sqlite3 import Error
def create_connection(db_file):
""" create a database connection to a SQLite database """
try:
conn = sqlite3.connect(db_file)
print(sqlite3.version)
conn.close()
except Error as e:
print(e)
if __name__ == '__main__':
create_connection('C:\\sqlite\\db\\base1.db')
On the Python command line I get
========= RESTART: C:\Users\pc\Documents\Programming\sqlitetest2.py =========
2.6.0
>>>
while in the relevant folder a new file base1.db has just appeared.