1.1檢查是否安裝了mysqlnode
rpm -qa |grep mysql
1.2卸載mysql
rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64
一步到位sql
rpm -e --nodeps $(rpm -qa |grep mysql)
cd mysql rpm -ivh *.rpm
service mysql start
cat /root/.mysql_secret # The random password set for the root user at Mon Jul 23 23:39:24 2018 (local time): 3BwgPfmuGCIPISFc //隨機密碼
mysql -uroot -p3BwgPfmuGCIPISFc //明文登錄
mysql> SET PASSWORD = PASSWORD('新的密碼');
mysql> grant all privileges on *.* to 'root' @'%' identified by '上面設置的密碼'; mysql> flush privileges;
//添加到開機啓動項 chkconfig --add mysql //開機啓動 chkconfig mysql on //檢查是否添加成功 chkconfig