Install MySQL Binary Package for RedHat Linux Enterprise 6.4
Download MySQL and upload it to the server
1. Download the mysql binary installation package from the Mysql official website.
Https://edelivery.Oracle.com/osdc/faces/SearchSoftware? _ AfrLoop = 2326871189822158 & _ afrWindowMode = 0 & _ adf. ctrl-state = hqkzyoa95_9
2. upload to the server and decompress the package
Tar-xzvf mysql-advanced-5.6.26-linux-glibc2.5-x86_64.tar.gz
Create a mysql account
Useradd mysql
Install the package required by mysql, libaio
Yum install libaio *
Place the decompressed mysql installation package to the specified installation location, change the owner to mysql, and create a soft connection for the mysql folder (for convenient management)
Music mysql-advanced-5.6.26-linux-glibc2.5-x86_64/app/
Chown-R mysql: mysql/apps/mysql-advanced-5.6.26-linux-glibc2.5-x86_64
Ln-s./mysql-advanced-5.6.26-linux-glibc2.5-x86_64 for mysql
Install mysql
Cd/app/mysql/scripts
./Mysql_install_db -- user = mysql -- basedir =/app/mysql -- datadir =/app/mysqldata
For ease of use, we configure the mysql user's configuration file. bash_profile and add the following content:
Export MYSQL_HOME =/app/mysql
Export PATH =$ {MYSQL_HOME}/bin: $ {PATH}
Configure mysql
Copy the default configuration file to/etc/my. cnf and configure
Cp./support-files/my-default.cnf/etc/my. cnf
The content in the modification is as follows:
Basedir =/app/mysql
Datadir =/app/mysqldata
Log_bin =/app/mysqllog/dbtest
Innodb_buffer_pool_size = 128 M
SQL _mode = NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES
Max_binlog_cache_size = 67108864
Max_binlog_size = 2147483648
Max_binlog_stmt_cache_size = 67108864
Binlog_cache_size = 131072
Innodb_log_files_in_group = 3
Innodb_log_group_home_dir =/app/mysql_innodb_log
Copy the mysql management script to/etc/init. d and make necessary modifications.
Cp mysql. server/etc/init. d/mysql
Modify basedir and datadir
Basedir =/app/mysql
Datadir =/app/mysqldata
Create a mysql service script connection in rc {3, 4, 5}. d, as follows:
Cd/etc/rc3.d | rc4.d | rc5.d
[Root @ DBTEST2 rc3.d] # ln-s ../init. d/mysql S99mysql
[Root @ DBTEST2 rc3.d] # ln-s ../init. d/mysql K01mysql
In S99mysql, S indicates system startup, 99 indicates the order in which services are started, and finally the services are started.
K01mysql where K indicates stopping the service following the system shutdown, 01 indicates stopping the service order, first shutting down
In the other two folders, perform the preceding steps in sequence.
Use the chkconfig command to add a service so that mysql will automatically start as the system starts.
[Root @ DBTEST2 rc5.d] # chkconfig -- list | grep mysql
Mysql 0: off 1: off 2: on 3: on 4: on 5: on 6: off
Change root Password
1. Use mysqld_safe -- skip-grant-tables to start the database, skip the authorization table, and modify the root user password.
[Root @ DBTEST2 mysql] #./bin/mysqld_safe -- user = mysql -- datadir =/app/mysqldata -- basedir =/app/mysql -- skip-grant-tables
Mysql> update user set password = password ('000000') where user = 'root ';
Mysql> flush privileges;
Restart the database.
This article permanently updates the link address: