MySQL8 於 CentOS 7/RHEL安裝後預設密碼

利用yum 安裝 MySQL 8 後(https://dev.mysql.com/doc/refman/8.0/en/linux-installation-yum-repo.html,https://dev.mysql.com/downloads/repo/yum/),

wget https://dev.mysql.com/get/mysql80-community-release-el7-2.noarch.rpm
yum localinstall  mysql80-community-release-el7-2.noarch.rpm
yum install mysql-community-server
安裝後 mysql 之管理帳號 root已經不再是空密碼,需先找尋預設密碼,才能繼續使用mysql_secure_installation
接著搜尋預設密碼,利用指令grep
$ su -
$ grep 'temporary password' /var/log/mysqld.log

若要搭配phpMyAdmin使用會發生cache_sha2_password問題
























(圖一)

請記得修改如以下
msyql -u root -p

>alter user 'root'@'localhost'
identified with mysql_native_password
by 'password';

參考如下
https://dev.mysql.com/doc/refman/8.0/en/linux-installation-yum-repo.html

https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password

這個網誌中的熱門文章

Upgrade php and httpd(apache) on CentOS 7

Installing VMware workstation pro on Ubuntu 22.X (Jammy Jellyfish)