Apache, PHP, MySQL, ASP.NET, JSP and Perl Solutions for your Web Development and Hosting Needs on Windows.
A Complete Web Development and Hosting Platform for Windows.

MySQL 4.1.21

Building a Web Server, for Windows

Requirements

  • None

Download

Our Configuration

  • %SYSTEMROOT% : Win2000 -> C:\WINNT, WinXP -> C:\Windows
  • Install to : C:\www\mysql

Setup

  • Unpack as C:\www\mysql-4.1.21
  • Rename directory C:\www\mysql-4.1.21 to C:\www\mysql
  • Copy MySQL configuration file C:\www\mysql\my-medium.ini (or your choice of one of the other included my-*.ini files) to your %SYSTEMROOT% directory
  • Rename file %SYSTEMROOT%\my-medium.ini (or the copied over my-*.ini file) to my.ini
  • Edit %SYSTEMROOT%\my.ini
    • Under Sections "[client]" and "[mysqld]", edit...
      • socket = C:/www/tmp/mysql.sock
    • Under Section "[mysqld]", insert...
      • basedir = C:/www/mysql/
      • datadir = C:/www/mysql/data/

MySQL Server Binaries

MySQL ships with a number of server binaries to choose from. For standard/typical use and functionality, the preference is for server binary 'mysqld-nt'. Server binaries with the '-nt' suffix should only be used under Windows NT/2000/XP/2003.

  • mysql-debug.exe: Compiled with full debugging and automatic memory allocation checking, symbolic links, and InnoDB and BDB transactional tables.
  • mysqld.exe: Support for InnoDB transactional tables.
  • mysqld-nt.exe: Support for named pipes.
  • mysqld-max.exe: Support for symbolic links, and InnoDB and BDB transactional tables.
  • mysqld-max-nt.exe: Support for symbolic links, InnoDB and BDB transactional tables, and named pipes.

Startup

MySQL can be installed as a Service (automatic or manual start-up) or started as a standalone console application. The MySQL server can be configured to listen (and communicate) on all interfaces (0.0.0.0), the loopback (127.0.0.1), or any other address. The MySQL server can also be configured to skip networking (TCP/IP) and/or connect via named-pipes (sockets).

  • Install the MySQL process as a Service.
    • [Default] Listen on all interfaces (0.0.0.0)...
      • C:\www\mysql\bin> mysqld-max-nt
        • --install
        • [automatic start (but not this first time)]
        • Or --install-manual
        • [manual start only]
    • Other options (edit my.ini), section '[mysqld]', insert...
      • Listen on loopback only (127.0.0.1)...
        bind-address=127.0.0.1
      • Do not use TCP/IP (IP addresses and ports) for connections, use named-pipes...
        bind-address=localhost
        skip-networking
        enable-named-pipe [Note option socket=C:/www/tmp/mysql.sock (default is 'socket=MySQL' for mysql and php) under sections '[client]' and '[mysqld]'; Make sure the specifed dir exists; Make sure to fill php.ini options mysql[i].default_socket = C:/www/tmp/mysql.sock and mysql[i].default_host = localhost; Use mysql[i]_connect('localhost:/www/tmp/mysql.sock', 'user', 'password')]
    • Start the MySQL Service...
      ...> NET START MySQL
  • Start MySQL as a standalone console application.
    • C:\www\mysql\bin> mysqld-max-nt --standalone --console
    • [option '--standalone': Dummy option to start as a standalone server; can be omitted and have the same effect]
    • [option '--console': Write error output on screen (as opposed to error log)]
    • Other command line arguments...
      • --bind-address=127.0.0.1
      • [Note that any IP address can be specified]
      • --skip-networking --enable-named-pipe --socket=mysql.sock
      • [option '--skip-networking': do not use TCP/IP -- only valid for localhost]
      • [option '--enable-named-pipe': allows connections to other NT machines without being dependant on a specific network layer (TCP/IP or IPX)]
      • [option '--socket=...': name of nt-pipe/socket to use for option '--enable-named-pipe']

Cleanup

  • Create a password for the 'root' mysql account...
    • C:\www\mysql\bin> mysqladmin -u root password set-root-password-here
  • Delete all insecure users...
    • Access the MySQL prompt...
      • C:\www\mysql\bin> mysql -u root -p
    • Display all databases, accounts, and access controls to individual databases...
      • mysql> SHOW DATABASES;
      • mysql> SELECT User, Host, Password FROM mysql.user;
      • mysql> SELECT Host, Db, User, Select_priv FROM mysql.db;
    • Remove all initial accounts except 'root@localhost'; remove 'test' database and privileges set...
      • mysql> DELETE FROM mysql.user WHERE User='';
      • [Remove anonymous users]
      • mysql> DELETE FROM mysql.user WHERE User='root' AND Host != 'localhost';
      • [Remove remote root]
      • mysql> DROP DATABASE test;
      • [Remove test database]
      • mysql> DELETE FROM mysql.db WHERE Db = 'test' OR Db = 'test\\_%';
      • [Remove privileges on test database]
      • mysql> FLUSH PRIVILEGES;
    • Exit.
      • mysql> quit;

Running MySQL

All commands are run from the command line and directory C:\www\mysql\bin (unless the mentioned dir is under the PATH)

  • Enter the command-line interface...
    > mysql -u root -p
  • Stop the MySQL Service (one of two ways)...
    > NET STOP MySQL
    > mysqladmin -u root -p shutdown
  • Uninstall the MySQL Service...
    > mysqld-max-nt --remove
  • Shutdown the standalone console MySQL application (one of two ways)...
    > mysqladmin -u root -p shutdown [Note that this is done from another cmd.exe window]
    Ctrl-C under the cmd.exe window it was started from

Help

All commands are run from the command line and directory C:\www\mysql\bin (unless the mentioned dir is under the PATH)

  • Display the MySQL command-line interface (shell) options...
    > mysql --help
  • Display mysql-max-nt options...
    > mysqld-max-nt --help
  • Display MySQL version information...
    > mysqladmin -V
  • See what values a running MySQL server is using...
    > mysqladmin -u <user> -p<password> variables
  • Display information...
    > mysqladmin -u <user> -p<password> version status proc
  • Update password for MySQL user 'root' (from the MySQL shell)...
    mysql> UPDATE mysql.user SET Password=PASSWORD('root-password') WHERE User='root';
    mysql> FLUSH PRIVILEGES;
In the Spotlight

In the Spotlight

Developing and Hosting PHP+MySQL based websites and applications has never been simpler. The Web.Developer Server Suite provides a Platform & Framework on which to create standards-based CSS, XSLT, and XHTML sites running on PHP and MySQL. Save your time, focusing on core business. Reduce complexity and maximize your productivity.

Developers

Developers++

The Web.Developer Server Suite is more than just a Windows based Apache|PHP|MySQL Platform. Suitable for novices and professionals alike, a complete Hosting Solution is provided that is capable of creating and deploying websites and web applications both locally and on the internet. Create, test, publish and maintain your websites in-house, on your own server, where you are in full control.

Newsletter Signup

Newsletter Signup

Enter your e-mail address: