Primary Server
On your Primary server, perform the following actions:
- 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
- Verify that your local disk partition is still mounted at /var/lib/mysql via the “df” command
- If this is a fresh MySQL install, initialize a sample MySQL database:
# /usr/bin/mysql_install_db – –datadir=”/var/lib/mysql” – –user=mysql
- 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
- 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 &
- 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]#
- 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
- Verify your new password:
# mysql mysql –u root –p
(Enter “SteelEye” as the password)
#exit
- 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
- Delete the original MySQL configuration file, located in /etc
# rm /etc/my.cnf
Secondary Server
On your Secondary Server:
- 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
- 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
- There is no need to perform any of the additional steps taken on the Primary Server
このトピックへフィードバック