Centos7 搭建 MYSQL資料庫

2021-09-23 14:13:17 字數 2710 閱讀 4078

rpm -qa|grep -i mysql 檢視命令
yum remove mysql 執行刪除操作
rpm -qa|grep -i mysql 檢視命令
yum remove ***  把展示出來的所有東西都刪除了
解除安裝原系統中的mariadb……

rpm -qa|grep mariadb 檢視命令

rpm -e --nodeps mariadb-libs 刪除 如果刪除不掉用 yum remove *** 刪除

wget

rpm -ivh mysql80-community-release-el7-1.noarch.rpm

yum repolist all | grep mysql

yum-config-manager --disable mysql80-community

yum-config-manager --enable mysql57-community

如果說上面的報錯yum-config-manager: command not found  執行yum -y install yum-utils

yum install mysql-community-server

啟動mysql:systemctl start mysqld.service

重啟mysql:systemctl restart mysqld.servicce

關閉mysql:systemctl stop mysqld.servicce

grep 'temporary password' /var/log/mysqld.log

mysql -u root -p

alter user user() identified by "herbert@123";   注意:mysql8.0以上版本密碼是遵尋密碼策略的,策略是必須需大於8位並且 包含 大寫小寫數字和特殊符號,不然就會報錯

我使用這個語句修改密碼的 但是網上大部分是用  alter user 'root'@'localhost' identified by 'herbert@123';修改密碼

如果修改簡單的密碼執行

set global validate_password_policy=0;

set global validate_password_length=1;

alter user user() identified by "root";

(1)開啟埠

檢視防火牆是否開啟:systemctl status firewalld

如果沒開啟:開啟 systemctl start firewalld

開放埠:firewall-cmd --add-port=3306/tcp --permanent

重新載入:firewall-cmd --reload

2)授權

修改root的許可權

update user set host='%' where user='root';

授權

grant all on *.* to 'root'@'%';

重新整理許可權

flush privileges;

修改密碼加密方式

alter user 'root'@'%' identified with mysql_native_password by 'herbert@123';

重新整理許可權

flush privileges;

如果還是連線不上,就重啟一下mysql

create user 'herbert'@'%' identified by 'denr';

grant all on *.* to 'herbert'@'%';

flush privileges;

alter user 'herbert'@'%' identified with mysql_native_password by 'herbert@123';

flush privileges;

騰訊雲centos7 搭建mysql

1.檢查環境 安裝前檢查是否安裝過mysql yum list installed mysql 如果有就用yum remove解除安裝mysql 2.1.官方yum源安裝 1 進入本機的源檔案目錄 cd usr local src 3 安裝mysql源 yum localinstall mysql5...

Centos7搭建LAMP Typecho部落格

yum install httpd 安裝httpd服務 systemctl start httpd 啟動httpd服務 systemctl status httpd 檢視httpd服務狀態,看到active active running 說明httpd服務已啟動 systemctl enable h...

centos7程序數 centos7最大程序數修改

之前我們按照原先的修改 etc security limits.d 90 nproc.conf,發現修改完後最大程序數顯示為15088 centos 7 使用systemd替換了sysv。systemd目的是要取代unix時代以來一直在使用的init系統,相容sysv和lsb的啟動指令碼,而且夠在程...