CentOS系統(tǒng)中如果需要重新安裝MySQL,可以按照以下步驟進(jìn)行操作:
1. 卸載原有MySQL # 先停止mysql服務(wù) systemctl stop mysqld # 查看是否有要?jiǎng)h除的mysql相關(guān)軟件 rpm -qa | grep -i mysql # 刪除mysql相關(guān)軟件 rpm -e 包名 2. 安裝新版MySQL # 添加MySQL的yum源 wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm rpm -ivh mysql-community-release-el7-5.noarch.rpm # 安裝MySQL yum install mysql-server 3. 啟動(dòng)MySQL服務(wù) # 啟動(dòng)服務(wù) systemctl start mysqld # 設(shè)置服務(wù)開機(jī)自啟動(dòng) systemctl enable mysqld 4. 配置MySQL # 重置root密碼 mysql_secure_installation # 登錄MySQL mysql -u root -p # 更改密碼 ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';