MySQL 5.6 rpm包 for linux 安裝
安裝系統(tǒng),并關(guān)閉selinux與iptables
1 關(guān)閉selinux 修改selinux配置文件(重啟
服務(wù)器生效)
[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 管理iptables(重啟服務(wù)器生效)
停止iptables
[root@mysql1 ~]# /etc/init.d/iptables stop
關(guān)閉iptables開機(jī)啟動(dòng)
[root@mysql1 ~]# chkconfig --list iptables
iptables 0:關(guān)閉 1:關(guān)閉 2:關(guān)閉 3:關(guān)閉 4:關(guān)閉 5:關(guān)閉 6:關(guān)閉
3 查詢系統(tǒng)是否存在mysql殘存包如果存在刪除處理,以保證mysql安裝無(wú)問題。
查詢
[root@mysql1 install]# rpm -qa|grep mysql
mysql-libs-5.1.71-1.el6.x86_64
存在并刪除
[root@mysql1 install]# rpm -e mysql-libs-5.1.71-1.el6.x86_64 --nodeps
4 安裝mysql相關(guān)文件
安裝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%]
安裝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%]
安裝 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 有中文存放mysql數(shù)據(jù)庫(kù) 修改參數(shù)文件(手動(dòng)建立即可)
[root@mysql1 install]# vi /etc/my.cnf
[client]
#客戶端字符集
default-character-set=utf8
[mysqld]
#字符集
character-set-server=utf8
#不區(qū)分大小寫
lower_case_table_names=1
[mysql]
#字符集
default-character-set=utf8
6 啟動(dòng)mysql服務(wù)
[root@mysql1 install]# /etc/init.d/mysql start
7 修改登錄密碼
初始密碼位置為安裝用戶根目錄下
[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 登錄并修改密碼
[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 修改默認(rèn)數(shù)據(jù)文件路徑
創(chuàng)建目錄
[root@mysql1 ~]# cd /home/
[root@mysql1 home]# mkdir mysql
停止mysql服務(wù)
[root@mysql1 home]# /etc/init.d/mysql stop
Shutting down MySQL..[確定]
10 CP 數(shù)據(jù)文件至新路徑
[root@mysql1 home]# cp -r /var/lib/mysql/ /home/mysql/
修改my.cnf文件與/etc/init.d/mysql文件
my.cnf文件添加socket路徑
[root@mysql1 home]# vi /etc/my.cnf
[client]
#客戶端字符集
default-character-set=utf8
socket = /home/mysql/mysql.sock
[mysqld]
socket = /home/mysql/mysql.sock
#字符集
character-set-server=utf8
#不區(qū)分大小寫
lower_case_table_names=1
[mysql]
#字符集
default-character-set=utf8
auto-rehash
修改mysql文件中datadir路徑信息
[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/
修改新建mysql存儲(chǔ)目錄權(quán)限(試過755和775都報(bào)錯(cuò) 只有賦值777時(shí)啟動(dòng)無(wú)問題,不知道什么原因)
[root@mysql1 home]# chmod -R 777 mysql/
[root@mysql1 home]# /etc/init.d/mysql start
Starting MySQL..[確定]
全文結(jié)束
分享標(biāo)題:mysql5.6forlinux(rpm包安裝)
網(wǎng)址分享:
http://weahome.cn/article/gdcdcg.html