Low cost ecommerce web development India flash website design

Working with .cnf files in Windows

It just so happens that files ending in .cnf have a special meaning to Windows, so even

if you have Windows configured to show file extensions, the my-small.cnf file will still

appear as simply my-small with a special icon. Windows actually expects these files to

contain SpeedDial links for Microsoft NetMeeting.

Assuming you don't use NetMeeting (or at least you don't use its SpeedDial facility) you

can remove this file type from your system, enabling you to work with these files normally:

1. Open the Windows Registry Editor (in WinNT/2000/XP/.NET, click Start, Run...,

and then type regedt32.exe to launch it, in Win9x/ME run regedit.exe instead).

2. Navigate to the HKEY_LOCAL_MACHINE\SOFTWARE\Classes branch of the registry,

where you'll find a list of all the registered file types on the system.

3. Select the .cnf key and choose Edit, Delete from the menu to remove it.

4. Log out and log back in, or restart Windows for the change to take effect.

If you prefer not to mess with the file types on your system, however, you should still be

able to open the files in Notepad to edit them and you can rename it to my.cnf by renaming

the SpeedDial link icon to my (Windows will maintain the .cnf extension automatically).

If you don't like the idea of a MySQL configuration file sitting in the root of your

C: drive, you can instead name it my.ini and put it in your Windows directory

(e.g. D:\WINDOWS or D:\WINNT if Windows is installed on drive D:). Whichever

you choose, open the file in Notepad and look for the following lines:

#basedir = d:/mysql/

#datadir = d:/mysql/data/

Uncomment these lines by removing the # symbol at the start, and change the

paths to point to your MySQL installation directory, using slashes (/) instead of

backslashes (\). For instance, I changed the lines on my system to read as follows:

basedir = d:/Program Files/MySQL/

datadir = d:/Program Files/MySQL/data/

With that change made, save the file and close Notepad. MySQL will now run

on your Windows NT/2000/XP system! If you're using Windows 95/98/ME, this

step is not necessary—MySQL will run just fine as-installed.

Just like your Web server, MySQL is a program that should be run in the background

so that it may respond to requests for information at any time. The

9

Installing MySQL

server program may be found in the bin subfolder of the folder into which you

installed MySQL. To make things complicated, however, there are actually several

versions of the MySQL server to choose from:

. mysqld.exe This is the basic version of MySQL if you run Windows 95, 98,

or ME. It includes support for all advanced features, and includes debug code

to provide additional information in the case of a crash (if your system is set

up to debug programs). As a result of this code, however, the server might

run a little slow, and I've generally found that MySQL is so stable that crashes

aren't really a concern.

. mysqld-opt.exe This version of the server lacks a few of the advanced features

of the basic server, and does not include the debug code. It's optimized to run

quickly on today's processors. For beginners, the advanced features are not a

big concern. You certainly won't be using them while you complete the tasks

in this book. This is the version of choice for beginners running Windows 95,

98, or ME.

. mysqld-nt.exe This version of the server is compiled and optimized like

mysqld-opt, but is designed to run under Windows NT/2000/XP/.NET as a

service. If you're using any of those operating systems, this is probably the

server for you.

. mysqld-max.exe This version is like mysqld-opt, but contains advanced features

that support transactions.

. mysqld-max-nt.exe This version's similar to mysqld-nt, but has advanced

features that support transactions.

All these versions were installed for you in the bin directory. If you're running

on Win98x/ME I recommend sticking with mysql-opt for now—move to mysqldmax

if you ever need the advanced features. On Windows NT/2000/XP/.NET,

mysqld-nt is my recommendation. Upgrade to mysqld-max-nt when you need

more advanced features.

Starting MySQL is also a little different under WinNT/2000/XP/.NET, but this

time let's start with the procedure for Win95/98/ME. Open an MS-DOS Command

Prompt2 and proceed to the MySQL bin directory, and run your chosen

server program:

2If you're unfamiliar with the workings of the Command Prompt, check out my article Kev's Command

Prompt Cheat Sheet [http://www.sitepoint.com/article/846] to get familiar with how it works before

you proceed further.

10

Installation

C:\mysql\bin>mysqld-opt

Don't be surprised when you receive another command prompt. This command

launches the server program so that it runs in the background, even after you

close the command prompt. If you press Ctrl-Alt-Del to pull up the task list, you

should see the MySQL server listed as one of the tasks that's active on your system.

To ensure that the server is started whenever Windows starts, you might want

to create a short cut to the program and put it in your Startup folder. This is just

like creating a short cut to any other program on your system.

On WinNT/2000/XP/.NET, you must install MySQL as a system service. Fortunately,

this is very easy to do. Simply open a Command Prompt (under Accessories

in the Start Menu) and run your chosen server program with the --install option:

C:\mysql\bin>mysqld-nt --install

Service successfully installed.

This will install MySQL as a service that will be started the next time you reboot

Windows. To manually start MySQL without having to reboot, just type this

command (which can be run from any directory):

C:\>net start mysql

The MySQL service is starting.

The MySQL service was started successfully.

To verify that the MySQL server is running properly, press Ctrl-Alt-Del and open

the Task List. If all is well, the server program should be listed on the Processes

tab.

website designer freelance ASP PHP ecommerce web developer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110