Due to firewalls, virus scans, corporate security restrictions, or just plain bad luck; there are times when MySQL just won’t install on a specific Windows server. Here’s a sure-fire install method. Relax, I won’t have you run the msi installer again.
The first step is to remove directories from your previous install attempts. Uninstall from the control panel. Manually, rename or delete “C:\Program Files\MySQL\MySQL Server 5.1″. Next, delete (or rename) the data directory. Warning! If you have previously entered data into MySQL, deleting the data directory will delete data. The directory is located at “C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\data”. You may need to unhide the data directory.
Let’s get started.
#1. Download the no-install MySQL Version for Windows. Choose either “Windows (x86, 32-bit) ZIP Archive” or “Windows (x86, 64-bit) ZIP Archive” based on whether your system is 64 or 32-bit .
#2. Unzip the files to “C:\Program Files\MySQL\MySQL Server 5.1″.
#3. Use notepad or wordpad to create a my.ini file and save the file in the MySQL directory, “C:\Program Files\MySQL\MySQL Server 5.1″ Be careful that notepad doesn’t add a default “.txt” extension to the my.ini file ( http://support.microsoft.com/kb/253688 )
Add the following following to your my.ini file and save.
[mysqld] ##update basedir if you move the install location basedir="C:/Program Files/MySQL/MySQL Server 5.1" ##update datadir if you move the data directory datadir="C:/Program Files/MySQL/MySQL Server 5.1/data" ## increase to 40% of RAM if using MyISAM key_buffer_size=32MB ## increase to 80% of available RAM for production usage innodb_buffer_pool_size = 128MB ## may want to increase if write intensive innodb_log_file_size = 64MB innodb_log_buffer_size=8MB table_cache=1024 thread_cache=16 query_cache_size=32M
Note the basedir and the datadir variables. If you wish to install in a different location or put the data in a different location, update these values accordingly.
#3. Create and start the service. Open a command prompt, and enter the following:
"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install "MySQL 5.1" --defaults-file="C:\Program Files\MySQL\MySQL Server 5.1\my.ini"
This installs the server. To start the service, type
net start "MySQL 5.1"
or start the service from the control panel.
You should be up and running. If not, check your err log in “C:\Program Files\MySQL\MySQL Server 5.1\Data”
#4. Connect from your client application and update your user accounts. By default, there are 3 accounts: root@localhost, root@127.0.0.1 and an anonymous account.
The following commands log in with the mysql command-line client, remove the anonymous account and set the password for the root accounts.
At a command prompt, enter the following:
"c:\program files\mysql\mysql 5.1 server\bin\mysql" -uroot
This will log you into MySQL and you should have a mysql command prompt like mysql>
Here are the commands to delete your anonymous account and set passwords for your two root accounts. When setting the password, substitute your desired password for “mypassword”.
mysql> DROP USER ""@localhost;
mysql> Set PASSWORD FOR "root"@"localhost" = password("mypassword");
mysql> Set PASSWORD FOR "root"@"127.0.0.1" = password("mypassword");
mysql> flush privileges;
mysql> exit
Feel free to post any questions/comments or issues to the comment section of this blog. For more comprehensive instructions see http://dev.mysql.com/doc/refman/5.1/en/windows-install-archive.html
My question is if you must install everything manually then why not set it up at C:\mysql? Is there a reason why you have retained the default paths that msi installer will use?
Also I want to know how one can setup MySQL to use multilingual support? I want to develop a Hindi words database. I want to be able to use Hindi’s natural collation. I thought this will be possible if I setup multilingual support.
Thanks for any reply and for very helpful blogs.
-Bakulesh Thakker (struggling to start stokastika.com statistical website and urduafsana.com hindi/urdu website)
Comment by Bakulesh Thakker — July 8, 2010 @ 11:03 am |
Hello. It’s fine to install in c:\mysql and there is no reason to retain the default paths.
Regarding character sets, I believe that you need to set the character set to utf8 and the collation to utf8_unicode_ci
Here’s a forum post which should help:
http://www.rhinocerus.net/forum/databases-mysql/293011-store-hindi-text-mysql-table-column.html
Here’s the appropriate link in the documentation:
http://dev.mysql.com/doc/refman/5.1/en/charset-applications.html
Comment by lstigile — July 8, 2010 @ 2:51 pm |
thanks for the reply
In the meantime my google searches has given me nearly same information as you but obviously I trust your information. You articles here have been great help. Thanks again.
-Bakulesh Thakker
Comment by Bakulesh Thakker — July 9, 2010 @ 2:48 pm
Hello Lee Stigile!
I tried to install using msi installer and choosing to run the default option of running MySQL Server Instance Config Wizard at end.
I did following twist:
In installer I chose “Custom” option instead of Typical or Complete so I can change folders where mysql will install and data folder. Then clicked Back button to select “Complete” option and continued from there on.
—–end of twist—–
In config wizard I chose almost all default options except for following:
(1) I cleared “Strict Mode” option just in case I may have to use some PHP applications written before strict mode was introduced.
(2) I chose “Best Support For Multilingualism”
(3) I selected the option to include the bin directory in Windows PATH.
(4) For InnoDB data folder I selected a different drive and different folder name (innodb) just so that I get a folder name without a space character.
Installation went through without any problem.
But now when I run phpinfo I get:
Client API version 5.1.48
Client API library version 5.1.48
Client API header version 5.0.51a
Will this cause any problems later? If all three version numbers were supposed to tally what has gone wrong? How do I fix it?
I must apologize for taking some of you time. But I found your information very trustworthy and that is why I am returning here. I hope you don’t mind at least recommending another forum where I can ask these questions.
Thanks, -Bakulesh Thakker
Comment by Bakulesh Thakker — July 12, 2010 @ 1:35 pm |
okay here is a link I found with similar problem: http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_22441507.html
searched google with words “incorrect Client API header version” (sans quotes) to find this link.
not sure if it is going to work. But since I am setting up a test environment for Apache, PHP and MySQL I dont mind playing with my system without fear of losing data/software. I am going to give it a try and see how it works.
-Bakulesh Thakker
Comment by Bakulesh Thakker — July 12, 2010 @ 2:41 pm |
Regarding the version differences, I’m not sure of the cause. Perhaps you could post on the MySQL php forum ( forums.mysql.com ).
Comment by lstigile — July 12, 2010 @ 3:06 pm |
@Bakulesh Thakker
The path c:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld.exe is actually embedded into the mysqld.exe file. You can use strings from cygwin to confirm this. It gets used when using the –install to register the windows service. So if you are going to use a windows service you have to be installed in this path.
Comment by Jay R. Wren — August 25, 2010 @ 6:09 pm |
I suspect that it is just a default setting. I’ve installed using the instructions above and it works just fine.
Comment by Lee Stigile — August 25, 2010 @ 6:49 pm |
Hi Lee, this is a great help.
What would I need to change to sucessfully complete a second installation of MySQL onto the same server?
Also, When I tried this method it would only work if I put the data into the same place as the software.
Colette
Comment by Colette — October 6, 2010 @ 10:06 am |
Hello
I ran a quick test and installed a second instance with the following steps:
-Stopped MySQL and copied the existing data to another directory ( E:\data)
-Copied the my.ini file and renamed the second version my2.ini.
-Updated the datadir and port in my2.ini. The datadir points to E:\data. The app is installed on C:\
Then, I ran the following:
mysqld –install “mysql2″ –defaults-file=”c:\installs\mysql51\my2.ini”
Comment by Lee Stigile — October 7, 2010 @ 9:25 pm |
Thanks Lee, that’s great, I tried this and everything went well, although I was puzzled for a while trying to login for the first time until I realised that because I copied the data directory the user accounts came with it from the previous installation.
Comment by Colette — October 8, 2010 @ 8:11 am |
Thank you so much! I was going crazy with the MSI file installer.
Comment by Chris — November 6, 2010 @ 12:31 am |
Oh God what, this actually worked. Thanks so much, bro.
Comment by Anonymous — August 11, 2012 @ 2:33 pm |
Hello Lee,
I am a college student trying to install MySql on Windows 7 for class. I followed the instructions as indicated but changed the basdir and datadir to the latest version (mysql-5.5.28-winx64). All installed perfectly but when trying to start, I get an error stating SERVICE NAME IS INVALID NET HELPMSG 2185. I tried looking in the err log but did not find an err log anywhere! Please HELP!
Clifton McDade
Comment by Clifton McDade — October 4, 2012 @ 7:39 pm |
I truly seem to agree with all the stuff that is put into writing within “Sure-fire
MySQL Install on Windows Managing Data”. Thanks for all the actual details.
Thank you,Jamika
Comment by http://tinyurl.com/goodjohn57031 — January 10, 2013 @ 9:33 pm |