Primary Server

On your Primary server, perform the following actions:

  1. Install both the “mysql” and “mysql-server” rpm packages if they do not exist on your system.

Apply any required dependencies as well

# yum install mysql mysql-server

  1. Verify that your local disk partition is still mounted at /var/lib/mysql via the “df” command
  1. If this is a fresh MySQL install, initialize a sample MySQL database:

# /usr/bin/mysql_install_db – –datadir=”/var/lib/mysql” – –user=mysql

  1. Ensure that all files in your MySQL data directory (/var/lib/mysql) have correct permissions and ownership

# chown –R mysql:mysql /var/lib/mysql

# chmod 755 /var/lib/mysql

  1. Finally, manually start the MySQL daemon from the command line.

# mysqld_safe – –user=root – –socket=/var/lib/mysql/mysql.sock – –port=3306 – –datadir=/var/lib/mysql – –log &

  1. Verify MySQL is running by connecting with the mysql client:

[root@LinuxPrimary mysql]# mysql

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.0.77-log Source distribution

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

mysql> exit

Bye

[root@LinuxPrimary mysql]#

  1. Update the root password for your mysql configuration. In this example we set the MySQL root password to “SteelEye”

# echo “update user set Password=PASSWORD where User=‘root’; flush privileges” | mysql mysql

  1. Verify your new password:

# mysql mysql –u root –p

(Enter “SteelEye” as the password)

#exit

  1. Create a MySQL configuration file. We will place this in the same shared directory (/var/lib/mysql/my.cnf)

# vi /var/lib/mysql/my.cnf

Example

# cat /var/lib/mysql/my.cnf

[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

pid-file=/var/lib/mysql/mysqld.pid

user=root

port=3306

# Default to using old password format for compatibility with mysql 3.x

# clients (those using the mysqlclient10 compatibility package).

old_passwords=1

# Disabling symbolic-links is recommended to prevent assorted security risks;

# to do so, uncomment this line:

# symbolic-links=0

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

[client]

user=root

password=SteelEye

  1. Delete the original MySQL configuration file, located in /etc

# rm /etc/my.cnf

Secondary Server

On your Secondary Server:

  1. Install both the “mysql” and “mysql-server” rpm packages if they do not exist on your system.

Apply any required dependencies as well

# yum install mysql mysql-server

  1. Ensure that all files in your MySQL data directory (/var/lib/mysql) have correct permissions and ownership

# chown –R mysql:mysql /var/lib/mysql

# chmod 755 /var/lib/mysql

  1. There is no need to perform any of the additional steps taken on the Primary Server

フィードバック

お役に立ちましたか?

はい いいえ
お役に立ちましたか
理由をお聞かせください
フィードバックありがとうございました

このトピックへフィードバック

送信