This HOWTO assumes that mysqld
(server) and mysql
(client) packages are already installed on the cluster and they are not running. Moreover, this HOWTO is for mysqld
version 5.6 that does not support the --initialize
flag.
1. Locate the paths for mysqld
and mysql
(They may not be in the $PATH
environment variable).
For example mysqld
is found in /opt/rh/rh-mysql56/root/usr/libexec
and mysql
is found in /opt/rh/rh-mysql56/root/usr/bin
2. Make directories in home directory (replace crsid1
by the username):
mkdir -p /home/crsid1/mysql/data; mkdir -p /home/crsid1/mysql/temp
3. Copy the template configuration file my-default.cnf
to the home directory as ~/.my.cnf
cp /opt/rh/rh-mysql56/root/usr/share/mysql/my-default.cnf ~/.my.cnf
4. Edit ~/.my.cnf
to configure mysql
and mysqld
(replace crsid1
by the username):
[mysql]
socket=/home/crsid1/mysql/mysql.sock
[mysqld]
# These are commonly set, remove the # and set as required.
datadir=/home/crsid1/mysql/data
tmpdir=/home/crsid1/mysql/temp
socket=/home/crsid1/mysql/mysql.sock
log-error=/home/crsid1/mysql/mysqld.log
6. Initialize server using mysql_install_db
:
/usr/bin/scl enable rh-mysql56 -- /opt/rh/rh-mysql56/root/usr/bin/mysql_install_db --keep-my-cnf --user=$USER
7. Start server using mysqld
:
/usr/bin/scl enable rh-mysql56 -- /opt/rh/rh-mysql56/root/usr/bin/mysqld_safe --defaults-file=/home/${USER}/.my.cnf &
9. Check that server is running using ps
10. Start client
/usr/bin/scl enable rh-mysql56 -- /opt/rh/rh-mysql56/root/usr/bin/mysql -u root -p
10. IMPORTANT RECOMMENDATION: In mysql shell set the root password for security (replace 'root_pwd'
by the root password)
SET PASSWORD = PASSWORD('root_pwd');
11. Quit and relogin to test password
1. Make sure the IPs of the nodes (in this case starting from 10.43) are part of the user (replace 'user'
by the new user's name and 'user_pwd'
by the user's password):
GRANT ALL ON *.* to 'user'@'10.43.%' IDENTIFIED BY 'user_pwd';
FLUSH PRIVILEGES;
2. Login to another node
3. Connect to server (replace 'hostname'
by the node's name, and 'username'
by the user's name):
/usr/bin/scl enable rh-mysql56 -- /opt/rh/rh-mysql56/root/usr/bin/mysql -u 'user' -h 'hostname' -p