The Linux yum command provides a detailed tutorial on installing mysql8.0

  • 2020-12-16 06:19:59
  • OfStack

1. Clean up before installation


rpm -pa | grep mysql  or  rpm -qa | grep -i mysql
yum remove mysql-xxx-xxx
find / -name mysql
rm -rf /xxx/xxx/xxx

2. Download the corresponding installation package

Download link: https: / / dev mysql. com/downloads/repo yum /

3. Install mysql

Execute the rpm file


rpm -ivh mysql57-community-release-el7-11.noarch.rpm

Install mysql


yum install mysql-community-server

Start the mysql service


serivce mysql start

Gets the initialization password


cat /var/log/mysqld.log | grep password

Go to the database and change the password


mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

Enable remote access


use mysql;
update user set host='%' where user='root';

Open 3306 port number


vim /etc/sysconfig/iptables
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
service iptables restart

conclusion


Related articles: