Now that you have PHP installed it’s time to install mysql. Mysql is the database server of choice for just about all forum software packages that run on PHP enabled servers. Installing mysql and getting it ready for use on your Windows Server is very easy. At the most it shouldn’t take more than an hour or less. Lets get started.
First thing you want to do is head over to mysql and download the latest 4.1.x version. Just like you did when you downloaded PHP you want to download the zip. Do not download the installer package. Download mysql here.
Open a remote desktop connection to your server or use an ftp client to upload the mysql zip. You can use the same procedure I outlined in Windows: Installing PHP to transfer the zip. In any case you need to be connected to the server with RDP.
Unzip the package and you should be left with a directory named mysql-noinstall-4.1.16-win32 or something similar. Inside that folder you’ll have mysql-4.1.6-win32 dir. Rename that to mysql-4.1.16. When we installed PHP, I am assuming you read the PHP install tutorial and followed it to install PHP, you noticed I named the PHP folder in a similar way. There is a reason for this. It is much easier to upgrade to new versions. No need to overwrite any files. Windows can be quirky at time when files are overwritten. You could wind up with problems. Doing it this way you’ll never have to worry about the install not working. Doing it this way also allows you to run 2 different versions of mysql is you choose.
Once you renamed the folder you can move it to your C drive or whatever drive is your root drive. You should have C:\mysql-4.1.6 and inside all the mysql folders such as bin, data, and docs.
Enter the mysql dir and rename my-medium.ini to my.ini.
Open my.ini with Notepad. You should see this:
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M#skip-networking
# Replication Master Server (default)
# binary logging is required for replication
log-bin# required unique id between 1 and 2^32 – 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id = 1[mysqldump]
quick
max_allowed_packet = 16M[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates[isamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M[myisamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M[mysqlhotcopy]
interactive-timeout
Now we need to add a couple lines to the file.
At the top of the file just under
[mysqld]
Add these 2 lines.
basedir=C:/mysql-4.1.6
datadir=C:/mysql-4.1.6/data
Now we have to change mysql.sock path to the correct path. There are 2 places to change this. Both are at the top of the file. One in the [client] section and one just below the paths you added.
Change
socket = /tmp/mysql.sock
to
socket = C:/mysql-4.1.6/mysql.sock
That’s all the editing you need to do. Once your site is getting a large amount of traffic you can tweak my.ini to optimize performance. Save the changes and close Notpad.
Open a command prompt, Start > Run > cmd.exe.
First start mysql to make sure everything works. To do that run this command.
C:\mysql-4.1.16\bin\mysqld –console
After it runs you should see some lines of text with the last being.
mysqld: ready for connections
If there is no errors then your ready to install mysql as a service. To do that first shutdown mysql with this command
C:\mysql-4.1.16\bin\mysqladmin -u root shutdown.
To install the service invoke this command.
C:\mysql\bin\mysqld-max-nt.exe –install
Mysql is now set to start whenever you reboot the server. Now lets start the service. To do that invoke this command
net start mysql
You should see some text that says mysql is now ready for connections. If it doesn’t start open Services manager and scroll down to the mysql service and see if the path to the binary is correct. The only time I ever had problems was when I invoked the install command without using the full path to the binary. If you did as stated above there should be no errors.
Now there is one last thing to do. Add the mysql bin directory to your path so that you can work at the command line without having to be in the mysql bin dir or using the full path to the dir.
To add mysql to your path right click My Computer. Select Advanced tab. Click Environment Variables. In the second box highlight PATH and select edit. Add
;C\mysql-4.1.16\bin
to the end of the path. Make sure you add it exactly as above including the ;.
Now open another command window and type mysql. You should see mysql > ready for connections.
Close the box. Congrats you now have mysql installed. You’ll want to head over to http://mysql.com and read the documentation to set root passwords and add new users.
Comments are closed.