centos7.6 安裝配置 mysql5.7

happyyuelao發表於2020-11-13

配置官方repo並安裝

wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server

MySQL資料庫設定
啟動mysql

systemctl start  mysqld.service

檢視自動生成的密碼

grep "password" /var/log/mysqld.log

在這裡插入圖片描述

進入mysql

mysql -uroot -p

輸入生成的密碼進入myql

修改密碼

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';

配置任何機器可以登入

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

相關文章