2

This has probably been asked before, but I am struggling to find the answer.

Historically I have always installed MySQL (on Windows) from a template based on the mysql-xxx-win64.zip file. I would basically

1) download the zip file, 
2) copy the contents to the new location, 
3) add in my template ini file, 
5) add in my template mysql directory (with default users) 
4) install a Windows Service, 
5) start MySQL

This has worked fine for years (5.5 and earlier). But now I am starting to test 5.7, and I find that the zip file no longer contains a data directory? If I try and create one by copying over from an existing database, I get an error.

Looking at the documentation I see that I am now supposed to initialize the data directory. But when I try this I get an error:

c:\MySQL\bin\mysqld.exe --initialize --user=mysql
mysqld: Can't change dir to 'C:\MySQL\DATA\' (Errcode: 2 - No such file or directory)

If I create the Directory it seems to work, but there is still no MySQL directory, so when I run mysql_upgrade or try and (start service then) login, it fails.

2016-05-16T09:03:16.222540Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist.

I found this post which says the password shouold be in the error log, but it isn't.

So, how am I supposed to install MySQL if they don't give us the data directory (and therefore mysql user etc. tables) anymore?

(and before someone suggests using the msi file - that's not an option as they are blocked on our network, and require me to jump through numerous hoops to even download it, let alone run it).

If I do: Copy MySQL Directory >> initialize >> install service >> start service, it seems to be ok, until I look in the error log and see that virtually every table has the wrong structure. But I can't run mysql_upgrade as I have no password, and mysql@localhost is access denied.


UPDATE: 2016-05-18

So I got hold of the MSI file, and (tried) to install using that. Eventually, I managed to get a copy of MySQL 5.7 installed and running. So now I need to install a second copy. The MSI installer fails at this point as I 'already have a copy installed', with no option that I can see to install another copy.

So I copied the MySQL Directory to a new folder, removed the DATA directory, updated the ini file, and ran c:\Mysql\...\mysqld.exe --initialize.

That re-created the DATA directory for me. I then set it up as a Service c:\Mysql\....\mysqld.exe --install MySQL57-2 --defaults-file=c:\MySQL\...\my.ini

I got the temporary password from the error log, and tried to log in, only to be told ERROR 1130 (HY000): Host '::1' is not allowed to connect to this MySQL server.

So I stopped the service, started Mysqld using --skip-grant-tables, logged in, added a new user, logged out, restarted the service. But still can't log in.

If it's going to be this much hassle every time I need to install a new Database, I think I'll just stick to 5.5.

  • You need to download a different installer - an MSI. The myssql site is terrible, confusing and generally just like other Oracle products. I'll post a link in a sec. – Thomas Pullen May 16 '16 at 9:37
  • I downloaded the ZIP file rather than the MSI (accidentally!) but decided to proceed with the installation following the instructions in the documentation. Windows 10 Pro x64. I hit the exact same problems you did, the --initialise command generated files in the data directory but I encountered errors when attempting to run the server in the console. Googled around for three hours, gave up and am now downloading the MSI. Curious to know whether this is a bug, a missing installation instruction or user error. – jamiecon Dec 3 '16 at 8:52
0

Here you go

mysql Windows installer

  • cheers, but I don't have access to MSI files (network restriction), plus they're not so easy to script / template when you need to set up multiple instances. hence the need to use the ZIP files. – IGGt May 16 '16 at 9:43
  • Meh. Any chance of getting round the network restriction? Surely if it's for a valid work purpose there should be exclusions? – Thomas Pullen May 16 '16 at 9:52
  • you'd think so.. But the other reason is that if am setting up multiple databases, it is easier to copy and paste a few folders rather than running through an MSI installer every time. – IGGt May 16 '16 at 9:59
  • right. Well hope you find a workaround, sorry I couldn't be more help. – Thomas Pullen May 16 '16 at 10:01
  • This is a horrible solution for something that should be included in the zip file distribution. On linux, mysql_install_db remedies this issue, but on windows it's just not included at all -- unless you install using the MSI which does a bunch of other things like install crap into system32 and so on. – Kraang Prime Jan 12 '17 at 13:55
-1

INSTALL MYSQL 5.7.25 ZIP ON WINDOWS 10 Install MySQL server 5.7.25 on Windows 10 using the zip/portable version. Using the zip version allows you to run multiple versions on the same development machine. https://cloudwrk.com/mysql-server-5-7-x-zip-install/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.