Centos7 安裝mysql 5 7詳細教程

2021-09-13 03:16:34 字數 2030 閱讀 9337

rpm -qa|grep mariadb
rpm -e --nodeps 檔名
rm /etc/my.cnf
rpm -qa | grep mysql
yum -y remove 檔名
wget
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
yum install mysql-server
service mysqld start
grep "password" /var/log/mysqld.log

將會返回如下內容,末尾字串就是密碼,把它複製下來:

a temporary password is generated for root@localhost: hilx0u!9i3_6

mysql -u root -p

輸入上面的密碼:hilx0u!9i3_6。注意:輸入密碼的時候沒有顯示,注意大小寫。建議使用第三方工具連線linux直接複製

由於 mysql5.7 採用了密碼強度驗證外掛程式 validate_password,因此我們得根據這個規則來設定。

如果只想設定簡單密碼需要修改兩個全域性引數:

set global validate_password_policy=0;

set global validate_password_length=1;

set password = password('your new password');
alter user 'root'@'localhost' password expire never;	

flush privileges;

grant all privileges on *.* to root@"%" identified by "new password";
grant all privileges on *.* to root@"localhost" identified by "new password";
flush privileges;
exit
firewall-cmd --zone=public --add-port=3306/tcp --permanent   //設定開放埠

firewall-cmd --reload //立即生效

firewall-cmd --zone=public --list-ports // 查詢是否生效

vim /etc/my.cnf

在 [mysqld] 前新增如下2行**:

[client]

default-character-set=utf8

在 [mysqld] 後新增如下**:

character_set_server=utf8

service mysqld restart

mysql -u root -p

輸入密碼:

查詢:show variables like '%character%'; 出現6個uf8代表設定成功

systemctl enable mysqld
啟動:systemctl start mysqld

停止:service mysqld stop

重啟:service mysqld restart

狀態:systemctl status mysqld

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...