Advertisment

MySQL on Windows

author-image
PCQ Bureau
New Update

MySQL is an RDBMS (Relational Database Management System) similar to MS SQL server and Oracle. MySQL database is available for Linux as well as Windows. We have given MySQL for Windows in the Developer section on this month’s CD. Unzip the archive and run ‘setup.exe’. MySQL database consists of a database server and client to connect to the server. This is similar to MS SQL server and the ‘Query Analyzer’ (the client). By default, MySQL will be installed in the c:\mysql directory. Go to the directory c:\mysql\bin and run the file ‘winmysqladmin.exe’. For the first time, a window titled ‘WinMySQLadmin Quick Setup’ pops up. Click on ‘Cancel’ button in this window. This will show a ‘traffic light’ icon on the task bar with the green light highlighted depicting that the database server is running. From the Windows Command Prompt, issue the following to start the MySQL command line client called ‘mysql’:

Advertisment





C:\mysql\bin\mysql —u root 





This will show the mysql prompt (mysql>). Now issue:

use mysql;



delete from user where user=’’;


delete from user where user=’root’ and host=’%’;







The second SQL command, removes the entry corresponding to anonymous users. In the Windows version of MySQL, by default, the ‘root’ MySQL user is allowed to connect from anywhere. We remove this behavior through the third SQL command. Now, quit from the mysql prompt with ‘quit’ and then issue the following command to set a password for the ‘root’:





C:\mysql\bin\mysqladmin —u root password pcq 





You may substitute ‘pcq’ with a password of your choice. For an in depth explanation of the above steps refer to Online Databases with MySQL, page 119,PCQuest October 2001. 




Shekhar Govindarajan

Advertisment