MySQL Installation

From Nwnx

Contents

Author: Rorrim

Source: CoPaP Devwiki

MySql

The following steps describe how to download, instal, and setup a MySql server on your Windows machine.

An excellent reference to this is the MySql online manual, found here.


Download

We're currently using an old version of the MySql database, v. 3.23.58. (Q: MySql is currently up to v 5.0; what's needed for an upgrade? A: 5.0 is bleeding edge)

The server can be downloaded here.

The Windows ODBC driver can be downloaded here.

Keep a copy of the Windows Trouble Shooting guide for MySql close by.

Installation

Server Install

  1. Download the server executable -- the "Windows Essentials" one is the easiest to install.
  2. Run the executable. Take all the defaults that apply. See this article for a step-by-step account of all the options you get during the install.
  3. Configure the server as needed. I don't recommend making it a windows service. If you do want to install it as a Windows service, see this article.
  4. After the install is done, pop open C:/Windows/my.ini.
    1. Make sure that the basedir variable is set to the root install of your MySql installation. For me this is "C:\\Program Files\\MySQL\\MySQL Server 4.1".
    2. Make sure the datadir variable is set to the data directory under the basedir.
  5. From a DOS prompt, go to the bin directory of your base install dir.
  6. Type into the prompt %mysqld-nt.exe --console. If all goes well you should see something like the following:

$ mysqld-nt.exe --console MyISAM: The first specified data file .\\ibdata1 did not exist: MyISAM: a new database to be created! 050212 15:09:08 MyISAM: Setting file .\\ibdata1 size to 10 MB MyISAM: Database physically writes the file full: wait... 050212 15:09:09 MyISAM: Log file .\\ib_logfile0 did not exist: new to be created

MyISAM: Setting log file .\\ib_logfile0 size to 5 MB MyISAM: Database physically writes the file full: wait... 050212 15:09:10 MyISAM: Log file .\\ib_logfile1 did not exist: new to be created

MyISAM: Setting log file .\\ib_logfile1 size to 5 MB MyISAM: Database physically writes the file full: wait... MyISAM: Doublewrite buffer not found: creating new MyISAM: Doublewrite buffer created MyISAM: Creating foreign key constraint system tables MyISAM: Foreign key constraint system tables created 050212 15:09:16 MyISAM: Started; log sequence number 0 0 c:\\Program Files\\MySQL\\MySQL Server 4.1\\bin\\mysqld-nt.exe: ready for connections . Version: '4.1.9-nt' socket: port: 3306 Source distribution

Testing the Server Install

  1. Pop open a DOS prompt
  2. Go to the bin directory of your MySql installation.
  3. Type in %mysqlshow.
  4. You should see something like the following:
$ mysqlshow

+-----------+
| Databases |
+-----------+
| mysql     | 
| test      | 
+-----------+

Creating the NWN user

Next you'll have to create the nwn user id used by NWNX. The following steps are taken from the MySql guide to adding users.

  1. Open up a DOS prompt
  2. go to the MySql bin dir
  3. type in %mysql --user=root mysql (if you've provided a root password, add a -p <password> )
  4. after connecting as root, you can add new accounts.
  5. on the mysql prompt, type in the following: mysql> GRANT ALL PRIVILEGES ON *.* TO 'nwn'@'localhost' IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
  6. and you should see the following output: "Query OK, 0 rows affected (0.45 sec)".

Changing the RootPassword

Make sure you change the root password, which defaults to blank!

  1. Open up a DOS prompt
  2. goto the Mysql bin dir
  3. run the following command: mysqladmin -u root -h localhost password "yournewpassword" where "yournewpassword" is the password you want for the root user

Using ODBC to Access a Database

Next you'll have to install the ODBC driver that allows NWNX to connect to your instance of MySql.

  1. First download the driver from the link give above.
  2. Run the installer. Take all the default options.
  3. Open Control Panel and select Administrative Tools. From there, select Data Sources (ODBC).
  4. The second tab is labeled System DSN. Select this tab and click on Add.
  5. In the new dialog, select the MySQL ODBC driver and click on Finish.
  6. A new dialog will appear. Make the following changes:
    1. Change Data Source Name to nwn.
    2. Description can be changed to anything you would like.
    3. Server should be localhost if the database server is installed locally, or the host name of the database server if it is installed remotely.
    4. User and Password should be the username and password you have created in the previous step.
    5. Click on the 'Test' button. A msg box should pop up with the the text "Success; connection was made."
  7. When finished, click OK. Your ODBC connection configuration is now complete.

Installing the Schema

Other Stuff

Personal tools