mysql -uroot -p'初始密碼'
ALTER USER 'root'@'localhost' IDENTIFIED BY '新密碼';
# 這里你可能遇到ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
# 你需要:
set global validate_password_policy=0;
set global validate_password_length=4;
set PASSWORD = PASSWORD('123456');
放開防火墻、設(shè)定自啟動(dòng)、增強(qiáng)MySQL安全設(shè)置等
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
/etc/init.d/iptables save
chkconfig mysqld on
mysql_secure_installation
更新到mysql-community-8.0.11-1.el7.x86_64產(chǎn)生的問題,mysql 5.7版本和8.0版本是不兼容的,你使用rpm安裝的5.7,使用rpm -e卸載之后數(shù)據(jù)文件還是存在的,mysql 8.0是啟動(dòng)不起來的,啟動(dòng)mysqld服務(wù)的時(shí)候,另開一個(gè)窗口,tail -f /var/log/mysqld.log打印日志,你就會(huì)發(fā)現(xiàn)Cannot upgrade server earlier than 5.7 to 8.0這句話,你要做的是把之前遺留的數(shù)據(jù)庫文件也刪掉或者移動(dòng)到其他地方,即rm -rf /var/lib/mysql/*,日志文件的路徑及數(shù)據(jù)庫文件路徑來源https://dev.mysql.com/doc/refman/8.0/en/linux-installation-rpm.html,其實(shí)只要把版本號(hào)換一下就是各個(gè)版本的rpm安裝教程