1. Download the repo source of mysql
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm /etc/yum.repos.d/ambari.repo
2. Install the mysql-community-release-el7-5.noarch.rpm package
rpm -ivh mysql-community-release-el7-5.noarch.rpm
After installing this package, you will get two mysql yum repo sources: /etc/yum.repos.d/mysql-community.repo, /etc/yum.repos.d/mysql-community-source.repo.
3. Install mysql
yum install mysql-server
4. Restart the MySQL service
systemctl restart mysqld
5. Reset password
mysql -u root
use mysql;
update user set password=password('123456') where user='root';
GRANT all privileges on *.* TO 'root'@'%' identified by '123456' WITH GRANT OPTION;
GRANT all privileges on *.* TO 'root'@'localhost' identified by '123456' WITH GRANT OPTION;
flush privileges; -- refresh privileges
6. Restart the service and add the hive user
systemctl restart mysqld
mysql -u root -p (create ambari user with root user and grant permissions)
create user 'ambari' identified by 'ambari';
GRANT all privileges on *.* TO 'ambari'@'%' identified by 'ambari' WITH GRANT OPTION;
GRANT all privileges on *.* TO 'ambari'@'localhost' identified by 'ambari' WITH GRANT OPTION;
GRANT all privileges on *.* TO 'ambari'@'master' identified by 'ambari' WITH GRANT OPTION;
flush privileges;
uninstall mysql
yum remove mysql
rm -rf /var/lib/mysql
rpm -qa|grep mysql
yum remove related services are as follows:
yum remove -y mysql-community-release-el7-5.noarch
yum remove -y mysql-community-libs-5.6.38-2.el7.x86_64
yum remove -y mysql-community-common-5.6.38-2.el7.x86_64
rm -rf /usr/lib/mysql
rm -rf /usr/share/mysql
rm -rf /usr/my.cnf