下載頁(yè)面:
https://dev.mysql.com/downloads/mysql/5.7.html#downloads
查詢是否有mysql相關(guān)庫(kù)
rpm?-qa?|?grep?mysql
查詢到mysql-libs-5.1.73-8.el6_8.x86_64
卸載之
yum?remove?mysql-libs
或
rpm?-e?mysql-libs-5.1.73-8.el6_8.x86_64?--nodeps
下載mysql安裝包
wget
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-server-5.7.22-1.el6.x86_64.rpm
wget
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-common-5.7.22-1.el6.x86_64.rpm
wget
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-libs-5.7.22-1.el6.x86_64.rpm
wget
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-client-5.7.22-1.el6.x86_64.rpm
開(kāi)始安裝
安裝順序common?->?libs?->?client?->?server
rpm?-ivh?mysql-community-common-5.7.22-1.el6.x86_64.rpm
rpm?-ivh?mysql-community-libs-5.7.22-1.el6.x86_64.rpm
rpm?-ivh?mysql-community-client-5.7.22-1.el6.x86_64.rpm
rpm?-ivh?mysql-community-server-5.7.22-1.el6.x86_64.rpm
啟動(dòng)mysql服務(wù)
service?mysqld?start
/etc/init.d/mysql?start
查看是否啟動(dòng)
ps?-ef?|?grep?mysql
netstat?-nat?|?grep?3306
netstat?-ntlp?|?grep?mysqld
獲取臨時(shí)密碼
cat?/var/log/mysqld.log?|?grep?'temporary?password'
登錄
mysql?-u?root?-p
修改密碼
set?password=password("新密碼");
創(chuàng)建數(shù)據(jù)庫(kù)
create?database?db1?default?character?set?utf8mb4;
創(chuàng)建并授權(quán)遠(yuǎn)程用戶
grant?all?privileges?on?db1.*?to?'user1'@'IP地址'?identified?by?'user1';
刷新權(quán)限
flush?privileges;
查看端口
show?global?variables?like?'port';
檢查是否不區(qū)分大小寫(xiě)
show?variables?like?'%case_table%';
退出mysql
exit;
修改端口
vim?/etc/my.cnf
加入
port=新端口號(hào)
忽略大小寫(xiě)
lower_case_table_names=1
重啟服務(wù)
service?mysqld?restart
開(kāi)發(fā)端口
vim?/etc/sysconfig/iptables
-A?INPUT?-m?state?--state?NEW?-m?tcp?-p?tcp?--dport?端口號(hào)?-j?ACCEPT
重啟防火墻
service?iptables?restart