MySQL Server Installation And Configuration

 

Related Docs:   Moving MySQL Upgrading to MySQL 4

Below is the procedure of installing MySQL database software and adding MySQL server to H-Sphere cluster.

 

Step-By-Step Installation

 

Step 1. Check for MySQL on your box

First, check whether MySQL database server is installed. You can do this by entering the following command into your command prompt:
which mysql

If it returns you a path, for example "/usr/bin/mysql", you have MySQL database software installed. Alternatively, you can try to find an installation of MySQL by running the following command in your command prompt:

rpm -qa | grep -i mysql

If this gives you something like:

mysql-4.0.16-0
mysql-client-4.0.16-0

you already have MySQL DBMS installed. See the list of H-Sphere packages for the version of MySQL packages currently installed with H-Sphere.

 

Step 2. Download MySQL

If you don't have MySQL installed, download MySQL binary RPM distribution. On the Web site www.mysql.com, go to the Download section, select the latest stable release, than select "The server for i386 systems" from the "Standard binary RPMs" list. Also, you will need client programs, so go back to the Download section and download "client programs for i386 systems" from the "Standard binary RPMs" list.

 

Step 3. Install MySQL

Now that you have downloaded MySQL database software installation package, execute the following command:
rpm -ivh /path/to/downloaded/mysql-4.xx.xx-x.rpm
where mysql-4.xx.xx-x.rpm is MySQL binary RPM distribution filename.

 

Step 4. Configure MySQL

To get MySQL working, you now need to configure the software installed.

Connection from H-Sphere to MySQL database is performed via SSH. In order to connect to MySQL database with a user name and password, put the .my.cnf file in the home directory of the user under which SSH connection is established. Typically, it is the mysql user. To find out the path to the MySQL home directory, log in as the mysql user under root, and then type pwd:
# su - mysql
# pwd

Or, finger the mysql user for details:
# finger mysql

In .my.cnf, you must insert the following lines:

[client]
user=login_of_some_highly_privileged_user
password=his_password

where login_of_some_highly_privileged_user is the login name of MySQL database user which have insert, update, delete, select, privileges on MySQL system database (those called mysql). his_password is the plain text password of this user.

WARNING: For security reasons, you MUST set access type for .my.cnf file to 0400 or 0600.

 

Step 5. Adding MySQL Server To H-Sphere

After you have installed and configured MySQL software on a new box, add MySQL server to H-Sphere cluster. If MySQL is installed on a live H-Sphere box, add MySQL as a new H-Sphere service.

 

MySQL Log File

/var/log/mysqld is the MySQL server log file.

 

Backing Up MySQL Database

To back up MySQL database, back up the MySQL home directory, or use the mysqldump utility to dump the database. Type 'man mysql', 'man mysqldump' or see MySQL documentation for details.

 

H-Sphere MySQL Scripts

On MySQL database box in /hsphere/shared/scripts the following scripts must be installed:

mysql-change-user-password - changes user password
mysql-change-user-password.sh - changes user password
mysql-db-size - calculates database size
mysql-db-size.pl - calculates database size
mysql-drop-database - drops database
mysql-drop-database.sh - drops database
mysql-resume-user - resumes suspended user
mysql-resume-user.sh - resumes suspended user
mysql-create-db - creates database
mysql-create-db.sh - creates database
mysql-db-users - lists MySQL database users who have any privilege on this database
mysql-db-users.sh - lists MySQL database users who have any privilege on this database
mysql-get-login.pl - gets superuser login and password
mysql-get-login.pl.sh - gets superuser login and password
mysql-revoke-all - revokes all user privileges on database
mysql-revoke-all.sh - revokes all user privileges on database
mysql-create-user - creates MySQL user
mysql-create-user.sh - creates MySQL user
mysql-delete-user - deletes MySQL user
mysql-delete-user.sh - deletes MySQL user
mysql-grant-priv - grants given privilege on given database to given user
mysql-grant-priv.sh - grants given privilege on given database to given user
mysql-suspend-user - suspends MySQL user
mysql-suspend-user.sh - suspends MySQL user

All scripts accept some command line parameters. All scripts consist of two parts. The first part typically without extension sets some necessary variables and then calls the second part of the script under sudo.

INFO: fix_perm.sh scripts sets needed owner and rights to mysql scripts.

WARNING: Some of this scripts are different on FreeBSD systems, so copy corresponding versions of scripts from /hsphere/shared/scripts/FreeBSD.

 

phpMyAdmin

To upgrade phpMyAdmin:

  1. Login as root to the web server box where phpMyAdmin is configured. (In /hsphere/local/home/cpanel/shiva/psoft_config/hsphere.properties file, PHP_MY_ADMIN_HOST points to the identifier of the logical server where phpMyAdmin is configured. Usually, it is the first web server added to the system.)
  2. Go to the directory /hsphere/shared/apache/htdocs/phpMyAdmin and back up the file config.inc.php. It has the required settings.
  3. Download the needed version of phpMyAdmin from www.phpmyadmin.net.
  4. Untar the file's content into the phpMyAdmindirectory in the apache DocumentRoot on the web server, e.g. /hsphere/shared/apache/htdocs/phpMyAdmin. Before you continue the installation, it would be a good idea to read the documentation supplied with phpMyAdmin installation package including the Documentation.txt file.
  5. Open config.inc.php in the phpMyAdmin directory. This file contains phpMyAdmin settings. Change $cfg['Servers'][$i]['host'], $cfg['Servers'][$i]['user'] and $cfg['Servers'][$i]['password'] to the values you have in the file you have backed up. The username and password are also available in the ~mysql/.my.cnf file.

Related Docs:   Moving MySQL Upgrading to MySQL 4







Home   Products   Services   News
© Copyright. . PSOFT. All Rights Reserved. Terms | Site Map