cdh-cdh5.8.3 offline installation--mysql5.7 binary deployment
1. Check whether the system has installed MySQL, need to uninstall clean
#rpm-qa|grep-i MySQL
Mysql-server-5.1.71-1.el6.x86_64
Mysql-5.1.71-1.el6.x86_64
Mysql-devel-5.1.71-1.el6.x86_64
Qt-mysql-4.6.2-26.el6_4.x86_64
Mysql-libs-5.1.71-1.el6.x86_64
Perl-dbd-mysql-4.013-3.el6.x86_64
#rpm-E mysql-server-5.1.71-1.el6.x86_64--nodeps
#rpm-E mysql-5.1.71-1.el6.x86_64--nodeps
#rpm-E mysql-devel-5.1.71-1.el6.x86_64--nodeps
#rpm-E qt-mysql-4.6.2-26.el6_4.x86_64--nodeps
#rpm-E mysql-libs-5.1.71-1.el6.x86_64--nodeps
#rpm-E perl-dbd-mysql-4.013-3.el6.x86_64--nodeps
2. Create MySQL user group and user, data directory and its user directory
#userdel MySQL #删除用户
#groupdel MySQL #删除用户组名
#mkdir/home/mysql #在home文件夹下创建文件夹mysql
#mkdir/home/mysql/data #在mysql文件夹下创建文件夹data
#groupadd MySQL #创建一个名为mysql的用户组
#useradd-G mysql-d/home/mysql MySQL #在用户组下创建用户
will report the following warning
Useradd:warning:the home directory already exists.
Not copying any file from the Skel directory into it.
The process is as follows:
#cp/etc/skel/.bash_profile/home/mysql
#cp/etc/skel/.bashrc/home/mysql
#cp/etc/skel/.bash_logout/home/mysql
3. Unzip the Software
#tar-XVF Mysql-5.7.17-linux-glibc2.5-x86_64.tar
#cd mysql-5.7.17-linux-glibc2.5-x86_64
#mv */home/mysql
4. Initializing MySQL Database
#./bin/mysqld--user=mysql--basedir=/home/mysql--datadir=/home/mysql/data--initialize--lc_messages_dir=/home/ Mysql/share--lc_messages=en_us
Note: The mysql_install_db is not already in use in version 5.7
[ERROR] Can ' t find error-message file '/home/mysql/share/errmsg.sys '. Check error-message file location and ' lc-messages-dir ' configuration directive.
Because there is no such thing as two system variables, Lc_messages_dir andlc_messages, normal default is no problem. Here we explicitly specify. Re-initialize
5. Detect if the MySQL service can be started
Just now I'm using/home/mysql as the MySQL installation directory basedir, the following error will occur when you start the service:
[[email protected] mysql]#./support-files/mysql.server start
./support-files/mysql.server:line 271:CD:/usr/local/mysql:no such file or directory
Starting mysqlcouldn ' t find MySQL server (/usr/local/mysql/[failed]ld_safe)
The default installation directory for MySQL's tar.gz installation package is/usr/local/mysql,
At this time we need to modify the Basedir and DataDir directory Paths of the/support-files/mysql.server files for the basedir and datadir paths of the MySQL where our environment resides
# Vim Support-files/mysql.server
--------------------------
...
Basedir=/home/mysql
Datadir=/home/mysql/data
...
--------------------------
#./support-files/mysql.server Start
Start starting MySQL. Ok!
6. Create a soft connection
# ln-s/home/mysql/bin/mysql/usr/bin/mysql
7. Create a configuration file
The default generated MY.CNF backup
# Mv/etc/my.cnf/etc/my.cnf.bak
Access to MySQL installation directory support file directory
# Cd/home/mysql/support-files
Copy profile template to new MySQL configuration file
# CP MY-DEFAULT.CNF/ETC/MY.CNF
Set the encoding, modify the new profile options as needed, do not modify the configuration options, and MySQL runs as the default configuration parameter.
# VIM/ETC/MY.CNF
[Mysqld]
Basedir =/home/mysql
DataDir =/home/mysql/data
#key_buffer = 16M
Key_buffer_size = 32M
Max_allowed_packet = 32M
Thread_stack = 256K
Thread_cache_size = 64
Query_cache_limit = 8M
Query_cache_size = 64M
Query_cache_type = 1
Max_connections = 550
#log_bin =/home/mysql/mysql_binary_log
Sql_mode=strict_trans_tables
Binlog_format = Mixed
Read_buffer_size = 2M
Read_rnd_buffer_size = 16M
Sort_buffer_size = 8M
Join_buffer_size = 8M
innodb_file_per_table = 1
Innodb_flush_log_at_trx_commit = 2
Innodb_log_buffer_size = 64M
Innodb_buffer_pool_size = 4G
Innodb_thread_concurrency = 8
Innodb_flush_method = O_direct
Innodb_log_file_size = 512M
Log-error=/var/log/mysqld.log
Pid-file=/var/run/mysqld/mysqld.pid
8. Configure the MySQL service to boot automatically
# Mkdir/var/run/mysqld
# Chown-r Mysql:mysql/var/run/mysqld
Comment out the log_bin, you need to set the server_id
Comment out Key_buffer, keep key_buffer_size
# cp/home/mysql/support-files/mysql.server/etc/init.d/mysqld # Copy boot file to/etc/init.d/and command for MYSQLD
# chmod 755/etc/init.d/mysqld # Increase execution permissions
# chkconfig--list mysqld # Check the self-startup item list without mysqld this,
# chkconfig--add mysqld # Add mysqld if not:
# chkconfig mysqld on # Set boot up with this command:
9. Initialize the root password of the MySQL user
#mysql-U root-p
Enter the previous random password
Mysql>set PASSWORD = PASSWORD (' 123456 '); # PASSWORD () 123456 is the new password I set, you can also set your password
Mysql>alter USER ' root ' @ ' localhost ' PASSWORD EXPIRE never;
Mysql>flush privileges;
10. Authorize all hosts to log in as root
Grant all on * * to ' root ' @ '% ' identified by ' 123456 ';
11. Create a MySQL Database
Hive Database
Create DATABASE hive DEFAULT CHARSET UTF8 COLLATE utf8_general_ci;
--Cluster monitoring database
Create database Amon DEFAULT CHARSET UTF8 COLLATE utf8_general_ci;
--hue Database
Create database Hue DEFAULT CHARSET UTF8 COLLATE utf8_general_ci;
--oozie Database
Create database Oozie DEFAULT CHARSET UTF8 COLLATE utf8_general_ci;
----Reports Manager
Create database Rman DEFAULT CHARSET UTF8 COLLATE utf8_general_ci;
cdh-cdh5.8.3 offline installation--mysql5.7 binary deployment