MySQL

 
 
MySQL is a fast, multi-threaded, multi-user open source SQL database server.

The MySQL database is released under the GNU General Public License (GPL). MySQL can be used for free when you are not distributing any part of the MySQL system. For example: If you run a commercial web site using the MySQL Database Software as long as MySQL is not distributed.

Please read the MySQL manual for situations where a commercial license is needed.

More information about MySQL can be found at: https://www.mysql.com

MySQL online manual can be found at: https://dev.mysql.com/doc/index.html

The latest MySQL version can be downloaded from: https://dev.mysql.com/downloads/index.html







Installing MySQL 4.0.18.



Information
none

Operating system used
Windows XP Home Edition Version 5.1 SP 2

Software prerequisites
none

Procedure
  1. If you have previously installed MySQL 3.23 and you want to install a new MySQL version do the following (for an upgrade read the documentation):

    • WARNING: THE FOLLOWING STEPS WILL COMPLETE REMOVE THE OLD MySQL INSTALLATION AND DATABASES. BE SURE IF YOU WANT TO DO THIS.
    • Stop the current server.
      Open a dos window and type: net stop mysql
    • Remove the previously installed mysql service.
      C:\..\mysql\bin>mysqld-nt --remove
    • Remove the old MySQL version:
      Start | Settings | Configuration Screen | Software | Select MySQL | Remove
    • Remove the old C:\..\mysql\ directory.

  2. Download and unzip mysql-4.0.18-win.zip

  3. Execute setup.exe to install MySQL Servers and Clients on your computer.

  4. Select the mysql destination folder, e.g.: C:\Tools\mysql.

  5. Select setup type: typical

  6. After installation you can find the MySQL Reference Manual in ..\mysql\Docs\
    A more recent version of this document and other documents can be found at: http://www.mysql.com/documentation/

    The data directory can be found in ..\mysql\data.

  7. Next step is to prepare the Windows MySQL Environment using the WinMySQLadmin tool.
    Execute file C:\..\mysql\bin>winmysqladmin.exe

    WinMySQLAdmin Setup

    Enter a username and password. The username will be used as the default system administrator name, e.g.:
    User name = myname
    password = mysecret

    Note:
    WinMySQLadmin creates a c:\windows\my.ini configuration file and setup the MySQL service to start automatically when Windows starts.

  8. The WinMySQLadmin window will disapper and a stoplight icon MySQL stoplight will appear in the system bar. Just right click on the icon and select "show me". The WinMySQLadmin window will be displayed.
    • Select "my.ini Setup" Tab
    • Check if Base Dir=C:/Tools/mysql
    • Press button: Pick-up and Edit my.ini" file
    • Verify if radio button mysqld-nt (see Note 1) is selected, otherwise select it.
    • Press button: Save Modifications
    • You should see:

      #This File was made using the WinMySQLAdmin 1.4 Tool
      #7-5-2004 17:19:30

      #Uncomment or Add only the keys that you know how works.
      #Read the MySQL Manual for instructions

      [mysqld]
      basedir=C:/Tools/mysql
      #bind-address=192.168.1.100
      datadir=C:/Tools/mysql/data
      #language=C:/Tools/mysql/share/your language directory
      #slow query log#=
      #tmpdir#=
      #port=3306
      #set-variable=key_buffer=16M
      [WinMySQLadmin]
      Server=C:/Tools/mysql/bin/mysqld-nt.exe
      user=myname
      password=mysecret




    You should see the following:

    WinMySQLadmin

    Note:
    Here is a list of the different MySQL servers you can use:

    Binary Description
    mysqld Compiled with full debugging and automatic memory allocation checking, symbolic links, InnoDB and BDB tables.
    mysqld-opt Optimized binary. From version 4.0 on, InnoDB is enabled. Before 4.0, this server includes no transactional table support.
    mysqld-nt Optimized binary for Windows NT, 2000, and XP with support for named pipes.
    mysqld-max Optimised binary with support for symbolic links, InnoDB and BDB tables.
    mysqld-max-nt Like mysqld-max, but compiled with support for named pipes.

  9. Do not close the WinMySQLadmin window yet.

  10. Verify if the correct MySQL service is setup.
    In the Windows Services window you should see: mysql service
    Right click this service and select properties.
    The path to executable file should be: C:/Tools/mysql/bin/mysqld-nt.exe
    If this is NOT the case:

    • Right click on the WinMySQLadmin window.

      WinMySQLadmin Menu

    • Select Win NT | Stop the Service
    • Again right click | Select Win NT | Remove the Service
    • Again right click | Select Win NT | Install the Service
    • Again right click | Select Win NT | Start the Service
    • Now check if the correct MySQL service is setup.


  11. Close the WinMySQLadmin window.

  12. Start the command line MySQL monitor:
    C:\..\mysql\bin>mysql -u root

    You should see:

    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 8 to server version: 4.0.18-nt

    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.


  13. The default privileges on Windows give all local users full privileges to all databases without specifying a password. To make MySQL more secure, you should set a password for all users and remove the row in the mysql.user table that has Host='localhost' and User=' '.
    You should also add a password for the root user. The following example starts by removing the anonymous user that has all privileges, then sets a root user password "mysecret":

    mysql> use mysql
    mysql> delete from user where host='localhost' and User='';
    mysql> quit
    C:\..\mysql\bin>mysqladmin reload
    C:\..\mysql\bin>mysqladmin -uroot password mysecret


  14. An overview of a few commands which can be executed within directory C:\..\mysql\bin>:

    Command Description
    mysqlshow -? Displays the help of mysqlshow. This command shows the structure of a mysql database.
    mysqlshow -u<user>
    -p<password> <database>
    Example: Display table names of a selected database.
    mysqlshow -uroot -pmysecret mobilefishdb
    mysqladmin -? Displays the help of mysqladmin. This command executes the administration program for the mysqld daemon.
    mysqladmin -u<user> password <password> Example: Set password "mysecret" for user root.
    mysqladmin -uroot password mysecret
    mysqladmin -u
    -p<old_password> password <new_password>
    Example: Change password into "mynewsecret" for user root.
    mysqladmin -uroot -pmysecret password mynewsecret
    mysql -? Displays the help of mysql. This command starts the command line MySQL monitor.
    mysql -u<user>
    -p<password>
    Example: Starts the command line MySQL monitor.
    mysql -uroot -pmysecret