Centos7安裝Mysql5 7並修改初始密碼

2022-05-04 12:57:08 字數 1339 閱讀 7454

wget 

然後進行repo的安裝

rpm -ivh mysql57-community-release-el7-9.noarch.rpm

執行完成後會在/etc/yum.repos.d/目錄下生成兩個repo檔案mysql-community.repomysql-community-source.repo

2、安裝mysql使用yum命令即可完成安裝

yum install mysql-server
3、啟動msyql:

systemctl start mysqld
4、配置mysql

獲取安裝時的臨時密碼:

grep 'temporary password' /var/log/mysqld.log
5、登入:

mysql -u root -p
登入成功後修改密碼:

這裡的密碼是g6=tz(?qdgy

使用預設的密碼登陸

mysql -uroot -p

修改密碼

alter user 'root'@'localhost' identified by 'root';

如果密碼設定太簡單出現以下的提示

必須修改兩個全域性引數:

首先,修改validate_password_policy引數的值

mysql> set global validate_password_policy=0; 

再修改密碼的長度

set global validate_password_length=1;

再次執行修改密碼就可以了

alter user 'root'@'localhost' identified by 'root';

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

flush privileges;

Centos7離線安裝mysql5

2.將部署包存放到 opt 資料夾下 3.解壓並安裝 cd opt mkdir mysql tar xvf opt mysql 5.7.30 1.el7.x86 64.rpm bundle.tar c opt mysql cd opt mysql rpm uvh rpm nodeps force1....

Centos7使用yum安裝Mysql5 7

centos7的yum源中預設是沒有mysql,因為現在已經用mariadb代替mysql了。安裝mysql rpm包 rpm ivh mysql57 community release el7 11.noarch.rpm 安裝mysql yum install mysql community se...

Centos 7 使用yum安裝mysql 5 7

wget 2 安裝mysql yum y install mysql57 community release el7 10.noarch.rpm yum y install mysql community server 3 啟動mysql systemctl start mysqld.service...