| ||||||||||
|
||||||||||
![]() |
||||||||||
Installing MySQL on WindowsTable of Contents
About this document About this documentThis document is a reference of installing MySQL and the steps I take to get it up and running. This document will make a LOT of assumptions because this is for my reference. This is just a list of things I need reminding for. I have done many, many installations on several versions of Windows including 2000, XP, and Vista. Also, I've installed MySQL versions from 3.x to 5.x. I believe this document is generic enough that it should get any permutation running. MySQL DocumentationIf the link hasn't changed, the the doco is at the site. Downloading the softwareIf the link hasn't changed, the the doco is at the site. Get the no-install zip archive. Extract the archiveTypically, I'll unzip to C:\mysql, but this can be changed and set in the option file. Option file
In the installation's directory tree, use any of the pre-made .ini files, but for my workstation at home
which will get minimal usage, I'll use my-small.ini. Save this file as C:\WINDOWS\my.ini Note - If you wanted to set up multiple instances, create a copy of [mysqld] section under [mysqld] and name it whatever. This instance of the service will need a unique name along with its own settings. Set the PATHCreate a mysql home pointer, "MYSQL_HOME" to wherever the installation was unzipped to. Modify the PATH variable to include where mysql.exe lives. "PATH=%PATH%;%MYSQL_HOME%\bin" MySQL Server TypeI guess any will work, but I'll use mysqld-nt just because. Start the MySQL serverImportant! CD to the bin directory where mysqld.exe lives. At the prompt, start mysql manually - "mysqld --console". If everything was fine up to this point, a bunch of stuff should fly up the screen. To stop mysql, "mysqladmin -u root shutdown". Start MySQL as a serviceImportant! CD to the bin directory where mysqld.exe lives. Using the selected server type, "mysqld-nt --install". To start the service, "net start mysql". If you want to install the service for different instances, "mysqld-nt --install [instance_name]". And then to start that, use "net start [instance_name]". Test the installationUsing the default users (root, no password), log into mysql and run simple SQL commands. Secure the default user accountsGive root a password, and wipe out the other default users. shell> mysqladmin -u root password "newpwd" shell> mysql -u root -p Enter password: [newpwd] mysql> DELETE FROM mysql.user WHERE User = ''; mysql> FLUSH PRIVILEGES; Common errorsSystem error 2. Make sure you are in the %MYSQL_HOME%\bin directory when installing the service. I always get this error when I don't CD to the bin directory first. Error 1067 the process terminated unexpectedly. The my.ini (or .cnf) file must be in place and the basedir and datadir configuration setting must be properly set. Especially if MySQL is not installed in the "default" location. Client does not support authentication protocol requested by server; consider upgrading MySQL client. Get into mysql and change the passwords using:
mysql> SET PASSWORD FOR 'the_user'@'host_machine' = OLD_PASSWORD('the_password');
|