Centos7 3安裝和配置Mysql5 7

2022-07-16 20:15:11 字數 2773 閱讀 3122

第一步:獲取mysql yum源

右擊 複製鏈結位址 

[root@localhost ~]# wget

-bash: wget: 未找到命令

我們先安裝下wget 

yum -y install wget

然後執行 wget 

安裝mysql源

yum -y localinstall mysql57-community-release-el7-11.noarch.rpm 

yum -y install mysql-community-server

第四步:啟動mysql服務

systemctl start mysqld

第五步:設定開機啟動

[root@localhost ~]# systemctl enable mysqld

[root@localhost ~]# systemctl daemon-reload

第六步:修改root本地登入密碼

mysql安裝完成之後,在/var/log/mysqld.log檔案中給root生成了乙個臨時的預設密碼。

這裡的臨時密碼 emv.r#mwe3ha

[root@localhost ~]#  mysql -u root -p

enter password: 

輸入臨時密碼 進入mysql命令列;

mysql> alter user 'root'@'localhost' identified by 'zhipengwang2012@';

query ok, 0 rows affected (0.00 sec)

修改密碼為 zhipengwang2012@    (備註 mysql5.7預設密碼策略要求密碼必須是大小寫字母數字特殊字母的組合,至少8位) 

第七步:設定允許遠端登入

mysql預設不允許遠端登入,我們需要設定下,並且防火牆開放3306埠;

mysql> grant all privileges on *.* to 'root'@'%' identified by 'zhipengwang2012@' with grant option;

query ok, 0 rows affected, 1 warning (0.01 sec)

mysql> exit;

bye退出下;

[root@localhost ~]# firewall-cmd --zone=public --add-port=3306/tcp --permanent

success

[root@localhost ~]# firewall-cmd --reload

success

[root@localhost ~]# 

開放3306埠

第八步:配置預設編碼為utf8

修改/etc/my.cnf配置檔案,在[mysqld]下新增編碼配置,如下所示:

編輯儲存完 重啟mysql服務;

[root@localhost ~]# systemctl restart mysqld

[root@localhost ~]# 

檢視下編碼:

mysql> show variables like '%character%';

| variable_name            | value                      |

| character_set_client     | utf8                       |

| character_set_connection | utf8                       |

| character_set_database   | utf8                       |

| character_set_filesystem | binary                     |

| character_set_results    | utf8                       |

| character_set_server     | utf8                       |

| character_set_system     | utf8                       |

| character_sets_dir       | /usr/share/mysql/charsets/ |

8 rows in set (0.00 sec)

CentOS 7 3安裝配置Powerline

一 powerline簡介及演示環境 powerline 是乙個極棒的 vim編輯器的狀態列外掛程式,主要用於顯示狀態行和提示資訊。特點 github docs 演示環境 系統 centos linux release 7.3.1611 core python 版本 系統自帶的 2.7.5 bash...

Zabbix安裝配置 CentOS7 3

1.最小安裝centos7 2.開啟網絡卡 sed i s onboot no onboot yes etc sysconfig network scripts ifcfg ens33 3.重啟網路服務 systemctl restart network 4.安裝vim yum y install ...

Centos7 3安裝和配置Mysql5 7

第一步 獲取mysql yum源 右擊 複製鏈結位址 root localhost wget bash wget 未找到命令 我們先安裝下wget yum y install wget 然後執行 wget 安裝mysql源 yum y localinstall mysql57 community r...