在centos 6.9 上rpm安裝mysql
在centos 6.9 上rpm安裝mysql
環境:
Linux:CentOS release 6.9 64bit
MySQL: mysq-5.7.18
1、在/home創建mysql目錄,下載如下四個軟件包
http://mirrors.sohu.com/mysql/MySQL-5.7/
wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-community-client-5.7.18-1.el6.x86_64.rpm
wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-community-common-5.7.18-1.el6.x86_64.rpm
wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-community-libs-5.7.18-1.el6.x86_64.rpm
wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-community-server-5.7.18-1.el6.x86_64.rpm
2、檢查mysql rpm相關的包是否安裝並去除
[[email protected] mysql]# rpm -qa | grep -i mysql
mysql-libs-5.1.73-8.el6_8.x86_64
[[email protected]
error: Failed dependencies:
libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-8.el6.x86_64
libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-8.el6.x86_64
mysql-libs is needed by (installed) postfix-2:2.6.6-8.el6.x86_64
[[email protected] mysql]#
將依賴包一並刪除
[[email protected] mysql]# yum remove -y mysql-libs
再次查詢是否刪除幹凈
[[email protected] mysql]# rpm -qa | grep -i mysql
[[email protected] mysql]#
3、同時安裝這四個rpm包
rpm -ivh mysql-community-client-5.7.18-1.el6.x86_64.rpm mysql-community-common-5.7.18-1.el6.x86_64.rpm mysql-community-libs-5.7.18-1.el6.x86_64.rpm mysql-community-server-5.7.18-1.el6.x86_64.rpm
4、出現缺少依賴包解決方式
[[email protected] home]# rpm -ivh mysql-community-client-5.7.18-1.el6.x86_64.rpm mysql-community-common-5.7.18-1.el6.x86_64.rpm mysql-community-libs-5.7.18-1.el6.x86_64.rpm mysql-community-server-5.7.18-1.el6.x86_64.rpm
warning: mysql-community-client-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
libnuma.so.1()(64bit) is needed by mysql-community-server-5.7.18-1.el6.x86_64
libnuma.so.1(libnuma_1.1)(64bit) is needed by mysql-community-server-5.7.18-1.el6.x86_64
libnuma.so.1(libnuma_1.2)(64bit) is needed by mysql-community-server-5.7.18-1.el6.x86_64
[[email protected] home]# yum install -y numactl
5、密碼獲取
第一次通過#grep "password" /var/log/mysqld.log 命令獲取MySQL的臨時密碼
用該密碼登錄到服務端後,必須馬上修改密碼,不然操作查詢時報錯誤
剛開始設置的密碼必須符合長度,且必須含有數字,小寫或大寫字母,特殊字符。
如果想設置簡單密碼,如下操作:
首先,修改validate_password_policy參數的值
mysql> set global validate_password_policy=0; #定義復雜度
mysql> set global validate_password_length=1; #定義長度 默認是8
mysql>set password for [email protected]=password(‘123456‘); #設置root密碼為123456
mysql> flush privileges; #刷新權限使配置生效
本文出自 “明日靈感” 博客,請務必保留此出處http://coolner.blog.51cto.com/957576/1930534
在centos 6.9 上rpm安裝mysql