Mysql 5.6for linux (rpm package installation)
Mysql 5.6rpm package for linux installation
Install the system and shut down selinux and iptables
1 close selinux and modify selinux configuration file (restart server takes effect)
[root@mysql1 ~] # vi / etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing-SELinux security policy is enforced.
# permissive-SELinux prints warnings instead of enforcing.
# disabled-No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted-Targeted processes are protected
# mls-Multi Level Security protection.
SELINUXTYPE=targeted
2 manage iptables (restart server takes effect)
Stop iptables
[root@mysql1 ~] # / etc/init.d/iptables stop
Turn off iptables and start up.
[root@mysql1] # chkconfig-- list iptables
Iptables 0: close 1: close 2: close 3: close 4: close 5: close 6: close
3 query whether there is a mysql residual package in the system, and if there is deletion processing, to ensure that there is no problem with the installation of mysql.
Query
[root@mysql1 install] # rpm-qa | grep mysql
Mysql-libs-5.1.71-1.el6.x86_64
Exist and delete
[root@mysql1 install] # rpm-e mysql-libs-5.1.71-1.el6.x86_64-nodeps
4 install mysql related files
Install server
[root@mysql1 install] # rpm-ivh MySQL-server-5.6.29-1.rhel5.x86_64.rpm
Warning: MySQL-server-5.6.29-1.rhel5.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... # [100%]
1:MySQL-server # # [100%]
Install devel
[root@mysql1 install] # rpm-ivh MySQL-devel-5.6.29-1.rhel5.x86_64.rpm
Warning: MySQL-devel-5.6.29-1.rhel5.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... # [100%]
1:MySQL-devel # # [100%]
Install client
[root@mysql1 install] # rpm-ivh MySQL-client-5.6.29-1.rhel5.x86_64.rpm
Warning: MySQL-client-5.6.29-1.rhel5.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... # [100%]
1:MySQL-client # # [100%]
5. The modified parameter files of mysql database can be stored in Chinese (can be established manually)
[root@mysql1 install] # vi / etc/my.cnf
[client]
# client character set
Default-character-set=utf8
[mysqld]
# character set
Character-set-server=utf8
# case insensitive
Lower_case_table_names=1
[mysql]
# character set
Default-character-set=utf8
6 start the mysql service
[root@mysql1 install] # / etc/init.d/mysql start
7 change the login password
The initial password location is under the root directory of the installation user.
[root@mysql1 ~] # cat / root/.mysql_secret
# The random password set for the root user at Thu Jul 28 14:31:34 2016 (local time): 903yX2XlB1edVpua
8 Log in and change the password
[root@mysql1] # mysql-uroot-p903yX2XlB1edVpua
Mysql > set password=password ('oracle')
Query OK, 0 rows affected (0.00 sec)
Mysql > use mysql
Mysql > UPDATE user SET Password = password ('oracle') WHERE User =' root'
Mysql > flush privileges
Mysql > exit
9 modify the default data file path
Create a directory
[root@mysql1 ~] # cd / home/
[root@mysql1 home] # mkdir mysql
Stop the mysql service
[root@mysql1 home] # / etc/init.d/mysql stop
Shutting down MySQL.. [OK]
10 CP data file to new path
[root@mysql1 home] # cp-r / var/lib/mysql/ / home/mysql/
Modify my.cnf file and / etc/init.d/mysql file
Add socket path to my.cnf file
[root@mysql1 home] # vi / etc/my.cnf
[client]
# client character set
Default-character-set=utf8
Socket = / home/mysql/mysql.sock
[mysqld]
Socket = / home/mysql/mysql.sock
# character set
Character-set-server=utf8
# case insensitive
Lower_case_table_names=1
[mysql]
# character set
Default-character-set=utf8
Auto-rehash
Modify datadir path information in mysql file
[root@mysql1 home] # vi / etc/init.d/mysql
# If you change base dir, you must also change datadir. These may get
# overwritten by settings in the MySQL configuration files.
Basedir=
Datadir=/home/mysql/
Modify the permissions of the new mysql storage directory (both 755 and 775 have reported an error. There is no problem with starting when assigning a value of 777. I don't know why.)
[root@mysql1 home] # chmod-R 777 mysql/
[root@mysql1 home] # / etc/init.d/mysql start
Starting MySQL.. [OK]
The full text is over.