Administering MySQL on NetWare
Articles and Tips: article
Senior Engineer
Novell, Inc.
rlyon@novell.com
01 Apr 2003
While for the most part MySQL is MySQL is MySQL, a few things are unique to MySQL on NetWare. In this AppNote, the third in a series of articles exploring MySQL on NetWare, we will cover the administration MySQL on NetWare, along with some elements that are unique to MySQL on NetWare.
- Introduction
- Installation Considerations
- Communication Architecture
- Changing the Data Directory
- Controlling How MySQL Reads Its Configuration Files
- Configuring Multiple MySQL Servers
- Starting MySQL with mysqld_safe
- Auto-Closing MySQL NLM Screens
- Conclusion
Topics |
MySQL, databases, network application development |
Products |
MySQL for NetWare |
Audience |
developers |
Level |
beginning |
Prerequisite Skills |
basic knowledge of SQL |
Operating System |
n/a |
Tools |
none |
Sample Code |
no |
Introduction
MySQL for NetWare is an open-source relational database management system that allows you to use Java, C, Perl, and PHP APIs to access persistent data. This AppNote answers a number of questions about administering MySQL on NetWare which have repeatedly come up on the MySQL newsgroup. Specifically, it addresses several installation considerations, communication architecture, configuration files, multiple MySQL servers, the mysqld_safe command, and screens.
This is the third in a series of articles addressing the topic of MySQL on NetWare. A list of previous articles in the series is provided at the end of this AppNote.
Installation Considerations
The information in this AppNote applies to MySQL 4.0.10 for NetWare, which requires a server running NetWare 6 Service Pack 3 or NetWare 6.5. MySQL for NetWare also requires an NSS (Novell Storage Services) volume for the data.
Complete the following steps to install MySQL for NetWare on a NetWare 6 SP3 server. If you selected "MySQL" during the installation of NetWare 6.5, these steps have already been completed.
Download the MySQL for NetWare distribution file and extract it to the root of the SYS volume of your server. You can obtain the file through the Novell Developers Kit (NDK) at http://developer.novell.com/ndk/mysql.htm.
Add "SYS:\MYSQL\BIN" to the server's search path by adding the following command to the SYS:\SYSTEM\AUTOEXEC.NCF file and by typing the command at the server console prompt:
SEARCH ADD SYS:\MYSQL\BIN
Create the required initial database by entering the following command at the server console prompt:
mysql_install_db
Start the MySQL server by entering the following command at the server console prompt:
mysqld_safe
You should see a screen similar to the one shown in Figure 1.
Figure 1: MySQL Server startup information screen.
Securing Your MySQL Installation
A default installation of MySQL is not secure. We recommend that you execute the following interactive Perl script at the server console prompt to secure your installation:
perl sys:/mysql/scripts/mysql_secure_installation.pl
This installation script will do the following:
Connect to your currently running MySQL server on port 3306
Set the root password
Remove the anonymous users
Disallow remote root login
Remove the test database
Note: The mysql_secure_installation.pl Perl script is a port of the mysql_secure_installation shell script for NetWare.
Installation File Structure
The following table is a list of the child directories of SYS:/MYSQL and a description of their contents.
Directory
|
Contents
|
bin |
Server and client executables |
data |
Databases and log files |
include |
C header files |
lib |
C libraries |
mysql-test |
Test suite |
scripts |
Support scripts |
share |
Localized error message files |
support-files |
Sample configuration files |
Communication Architecture
Figure 2 shows the communication architecture of MySQL on NetWare. MySQL client applications (including most of the MySQL command-line utilities) can be executed on the same or different machine and between the same or different operating systems.
Figure 2: Communication architecture of MySQL.
Changing the Data Directory
By default, the MySQL databases and most log and status files are stored in the data directory. The default data directory is compiled into the MySQL server; on NetWare, it is sys:/mysql/data. (On NetWare the data directory must be on an NSS volume.)
You can move/change the data directory by following these steps:
Shut down the MySQL server using the following command at the server console:
mysqladmin -u root -p shutdown
If you secured the installation and/or have a password for your root user, you will need to enter the password. Otherwise the -p option can be left off.
Move the data directory to another location. For example, you might copy or move the sys:/mysql/data directory to vol1:/data.
Start the MySQL server with the "--datadir" option pointing to the new data directory, as in this example:
mysqld_safe --datadir=vol1:/data
Note: Alternatively, you could add the datadir option to the mysqld section of the configuration file. See the next section for more information.
Controlling How MySQL Reads Its Configuration Files
The MySQL server and client utilities read options from the following locations:
sys:/etc/my.cnf (global configuration file)
sys:/mysql/data/my.cnf (server configuration file)
mysqld_safe --log-bin (command line arguments)
The options are always read in the above order. The later option specification will take precedence.
You can use the following options to control the reading of configuration options by the MySQL server and client utilities. These options must be the first argument to an executable.
Option
|
Description
|
--no-defaults |
Ignore all configuration files. |
--print-defaults |
Display the options that would be used by this executable. |
--defaults-file=path |
Use only the specified configuration file. |
--defaults-extra-file=path |
Use the specified configuration file in addition to the other configuration files. It is read after the global configuration file. |
The configuration files are divided into sections by executable. For example, the options for the following two executables could be moved to the configuration file as shown.
mysqladimin --user=root mysqld_safe --datadir=vol1:/data --skip-locking
In the configuration file, these options would appear as follows:
[mysqladmin] user = root [mysqld] datadir = vol1:/data skip-locking
Configuring Multiple MySQL Servers
It is possible to have a number of MySQL servers running at the same time on the same machine. The advantages to this include having distinct rights and privileges for each server, and being able to run multiple versions of MySQL (a stable version and a development version, for example).
The most important thing to remember is that each MySQL server instance must have a unique port and data directory. The following steps will create two instances of the MySQL server running on ports 3306 and 3307 and using the data directories vol1:/data1 and vol1:/data2 respectively.
Enter the following commands on server console to create initial databases in the vol1:/data1 and vol1:/data2 directories:
mysql_install_db --datadir=vol1:/data1 mysql_install_db --datadir=vol1:/data2
Start each instance of the MySQL servers by using the following commands on server console:
mysqld_safe --port=3306 --datadir=vol1:/data1 mysqld_safe --port=3307 --datadir=vol1:/data2
Each instance of the MySQL server can be shut down individually with the following commands on server console:
mysqladmin --port=3306 shutdown mysqladmin --port=3307 shutdown
Starting MySQL with mysqld_safe
The mysqld_safe command/process is a monitor process for the MySQL server (mysqld). On NetWare, mysqld_safe is a NetWare Loadable Module (NLM) ported from the original mysqld_safe shell script.
We recommend that you always start the MySQL server using the mysqld_safe command. It will do the following for you:
Run a number of system and option checks
Run a check on the MyISAM and ISAM tables
Provide a screen presence for the MySQL server
Start mysqld
Restart mysqld if it goes down on an error
Send error messages from mysqld to a hostname.err file in the data directory
Send mysqld_safe screen output to a hostname.safe file in the data directory
Auto-Closing MySQL NLM Screens
A number of the MySQL NLMs create their own screen to present information to the user and to support the input of passwords when required. By default, none of the MySQL NLMs with screens closes the screen on exit-they display an ugly screen such as the one shown in Figure 3 and you must press a key before the screen destructs.
Figure 3: Default shutdown screen for MySQL NLMs.
While leaving the screen open can be helpful at times, in some cases it can get in the way. Fortunately, there is a solution. For all of the MySQL NLMs that have their own screen (except mysqld_safe.nlm), redirecting the standard output to a file will cause the screen to auto-destruct.
For example, if you issue the following command at the console you are left with an ugly screen like the one shown above:
mysqladmin shutdown
However, if you enter the command as follows, the screen will go away by itself:
mysqladmin shutdown > file
For the mysqld_safe.nlm, you need to use the "--autoclose" option for the screen to auto-destruct, as shown here:
mysqld_safe --autoclose
Conclusion
This AppNote has presented some practical information on administering MySQL on NetWare.
* Originally published in Novell AppNotes
Disclaimer
The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.