Datasheet

5. Because you want to set up a secure service, you want to change the blank user for the
localhost host. Type the following:
mysql> DELETE FROM user WHERE Host=’localhost’ AND User=’’;
You will get a response from MySQL that states:
Query OK, 1 row affected (0.07 sec)
The time it takes to process the query may differ based on the speed of your computer, but the
important thing here is that you get the “OK” from the MySQL gods.
6. Then get out of MySQL again and reset the users by entering the following:
mysql> quit
c:\>c:\mysql\bin\mysqladmin -u root reload
c:\>c:\mysql\bin\mysqladmin -u root password mysqlpass
7. Insert whatever password you would like for your root access; in this example, we chose the
word “mysqlpass.”
8. To reconnect to the server, try your new password:
C:\>c:\mysql\bin\mysql -h localhost -u root -p
You will be prompted for your password; in this case, enter “mysqlpass” or whatever you chose
for your root password. You should then see the prompt shown in Figure 1-10.
Figure 1-10
The my.cnf File
The my.cnf file, which you can open with any text editor, such as Notepad, is the main file that MySQL
uses to read configuration options you have set up in your installation. You can alter this file at any time
to tweak your configuration down the road.
By default, the installation of MySQL provides four sample
my.cnf configuration files to use as exam-
ples:
my-small.cnf, my-medium.cnf, my-large.cnf, and my-huge.cnf. If you used the default direc-
tory during installation, these were all saved under the
c:\mysql\ directory. If for some reason your
copy of the installation zip file did not include these sample files, you can use the one provided here
(you will just need to type it in from scratch using Notepad).
21
Configuring Your Installation
04_579665 ch01.qxd 12/30/04 8:09 PM Page 21