MySQL

NST provide an easy and convenient means to setup a MySQL database engine. Once that an initial instance of a MySQL database is configured and running, one can then manage the database engine with tools found in the web interface.

The setup_mysql script is shown below. It allows for the runtime database engine to be created and run from a RAM disk or a pre-existing directory. The directory (i.e. runtime directory) can be a mount point on a locally attached disk drive or a networked file system. This allows for permanent database storage when using NST.

        
[root@probe root]# /usr/local/bin/setup_mysql -h

Usage: setup_mysql [-s] [-d] [-rd <RAM device>] [-rds <RAM disk size (MB)>]
                   [-rmp <RAM mount point>] [-rdir <runtime directory>] [-v] [-h]

     This script is used to create an initial MySQL multi-user, multi-threaded SQL database
     server configuration for a NST system. The default configuration will create a 64MB RAM
     disk for the MySQL's database files at directory location: /mnt/ram4/var/lib/mysql.
     The MySQL database server engine will be started by this script.

     A "root" password will be assigned to the database. Any additional configuration to
     the database will be the responsibility of the database administrator.

  -s | --stop
     Use this optional parameter to stop an already running MySQL database server. If this
     option is not used and a MySQL database server is already running, this script will
     terminate leaving the existing database server running.

  -d | --delete
     Use this optional parameter to delete an existing MySQL database directory
     structure. This will allow one to startup a new fresh MySQL database.
     ** Note: This option will destroy any previous database data that may exist. Make any
              necessary backups prior to using this option.

  -rd <RAM device> | --ram-device <RAM device>
     Use this optional parameter to change the default RAM device that will be used for this
     instance of the MySQL database data files. Available RAM device names on NST:
     "/dev/ram0 - /dev/ram9". A cooresponding mount point: "/mnt/ram0 - /mnt/ram9"
     will be automatically selected for the RAM device. One can use the following optional
     parameter: "-rmp <mount point>" to change mount point location for the selected RAM
     device.
     Default: "/dev/ram4"

  -rds <RAM dsk size (MB)> | --ram-disk-size <RAM disk size (MB)>
     Use this optional parameter to change the default RAM disk size in MegaBytes (MB) that
     will be used for MySQL database data files.
     Default: "64"
     ** Note: Use a reasonable value and make sure you to not exceed your available system RAM.
              The system memory utility: "free" can be used to help make your determination.

  -rmp <mount point> | --ram-mount-point <mount point>
     Use this optional parameter to change the selected RAM device's: "-rd <RAM device>"
     mount point for the MySQL database data files.
     Default: "/mnt/ram4"

  -rdir <runtime directory> | --runtime-directory <runtime directory>
     One can use this optional parameter to force the setup script to use an existing
     directory on a locally attached disk drive or a mounted network file system and
     bypass the creation of a RAM disk. To do this, make sure the directory initially
     exists prior to running this script.
     Example:         Mount Point: "/dev/hda1" mount at: "/probe1" type ext3 (rw)
                        Directory: "/probe1/mysql"
                              Use: "-rdir /probe1/mysql" to create the top level runtime
                                   directory structure the MySQL database data files.
              Directory Structure: mysql  => /probe1/mysql/var/lib/mysql

  -v | --verbose
     This optional switch will enable verbose output. Without this switch set, minimal
     output from the execution of this script will be displayed.

  -h | --help
     Displays this help information.

        
      

Note

This script only configures and starts an initial instance of the MySQL database. It also creates a database administration user: "root" with an assigned password set to the NST clear text password. The clear text password for user: "root" can be found from the environment variable: "NSTCTPASSWD" which is generated by sourcing the NST configuration file: "/etc/nst.conf". No additional user tables or databases are created. Any configuration beyond this point will be the responsibility of the database administrator.

The following example creates a MySQL database at the runtime directory location: "/mnt/ext3/mysql". In this example, the NST probe system has a locally attached disk drive which was formatted using an Linux Ext3 file system.

        
[root@probe root]# setup_mysql -rdir /mnt/ext3/mysql -v
*** Creating a new MySQL database file structure at: "/mnt/ext3/mysql/var/lib/mysql"...

*** Starting up the MySQL database server...
Initializing MySQL database:                               [  OK  ]
Starting MySQL:                                            [  OK  ]

*** Assigning a password for database user: "root"...

*** Successfully started up a MySQL database server...

*** List MySQL Database Directory...
/mnt/ext3/mysql/var/lib:
total 12
drwxr-xr-x    3 root     root         4096 Jun 21 13:01 .
drwxr-xr-x    3 root     root         4096 Jun 21 13:01 ..
drwxr-xr-x    4 mysql    mysql        4096 Jun 21 13:01 mysql

/mnt/ext3/mysql/var/lib/mysql:
total 16
drwxr-xr-x    4 mysql    mysql        4096 Jun 21 13:01 .
drwxr-xr-x    3 root     root         4096 Jun 21 13:01 ..
drwx------    2 mysql    mysql        4096 Jun 21 13:01 mysql
srwxrwxrwx    1 mysql    mysql           0 Jun 21 13:01 mysql.sock
drwx------    2 mysql    mysql        4096 Jun 21 13:01 test

/mnt/ext3/mysql/var/lib/mysql/mysql:
total 112
drwx------    2 mysql    mysql        4096 Jun 21 13:01 .
drwxr-xr-x    4 mysql    mysql        4096 Jun 21 13:01 ..
-rw-rw----    1 mysql    mysql        8778 Jun 21 13:01 columns_priv.frm
-rw-rw----    1 mysql    mysql           0 Jun 21 13:01 columns_priv.MYD
-rw-rw----    1 mysql    mysql        1024 Jun 21 13:01 columns_priv.MYI
-rw-rw----    1 mysql    mysql        8982 Jun 21 13:01 db.frm
-rw-rw----    1 mysql    mysql         302 Jun 21 13:01 db.MYD
-rw-rw----    1 mysql    mysql        3072 Jun 21 13:01 db.MYI
-rw-rw----    1 mysql    mysql        8641 Jun 21 13:01 func.frm
-rw-rw----    1 mysql    mysql           0 Jun 21 13:01 func.MYD
-rw-rw----    1 mysql    mysql        1024 Jun 21 13:01 func.MYI
-rw-rw----    1 mysql    mysql        8958 Jun 21 13:01 host.frm
-rw-rw----    1 mysql    mysql           0 Jun 21 13:01 host.MYD
-rw-rw----    1 mysql    mysql        1024 Jun 21 13:01 host.MYI
-rw-rw----    1 mysql    mysql        8877 Jun 21 13:01 tables_priv.frm
-rw-rw----    1 mysql    mysql           0 Jun 21 13:01 tables_priv.MYD
-rw-rw----    1 mysql    mysql        1024 Jun 21 13:01 tables_priv.MYI
-rw-rw----    1 mysql    mysql        9148 Jun 21 13:01 user.frm
-rw-rw----    1 mysql    mysql         428 Jun 21 13:01 user.MYD
-rw-rw----    1 mysql    mysql        2048 Jun 21 13:01 user.MYI

/mnt/ext3/mysql/var/lib/mysql/test:
total 8
drwx------    2 mysql    mysql        4096 Jun 21 13:01 .
drwxr-xr-x    4 mysql    mysql        4096 Jun 21 13:01 ..

*** List MySQL Processes...
root       902   697  0 13:01 ttyp0    00:00:00 /bin/bash /usr/local/bin/setup_mysql -rdir /mnt/ext3/mysql -v
root       965     1  1 13:01 ttyp0    00:00:00 /bin/sh /usr/bin/safe_mysqld --defaults-file=/etc/my.cnf
mysql      991   965  1 13:01 ttyp0    00:00:00 /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/usr --datadir=/mnt/ext3/mysql/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking

        
      

At this point a MySQL database engine is up and running and ready for user database and table creation. Management of the database engine can now proceed with a web-based tool found in ???.