当前位置:网站首页>Liunx installing MySQL

Liunx installing MySQL

2022-06-22 22:09:00 Gu Bei!

One 、yum install

Use yum install
01. Check to see if... Is installed mysql service
rpm -qa | grep mysql

View the current linux Kernel version
cat /etc/redhat-release

02. Go to mysql Of yum Installation Library (MySQL :: Download MySQL Yum Repository), Download the corresponding version

 

03. Copy the file name , Carry out orders
 wget https://dev.mysql.com/get/mysql80-community-release- el7-3.noarch.rpm

04. install mysql Source
sudo rpm -Uvh mysql80-community-release-el7-3.noarch.rpm

see mysql Installable versions
 yum repolist all | grep mysql

Use MySQL Yum Repository install MySQL, The latest stable version will be selected by default

05. install mysql

sudo yum install mysql-community-server

06. start-up mysql
systemctl start mysqld.service

  stop it mysql

systemctl stop mysqld.service
restart mysql
systemctl restart mysqld.service

Two 、 Manual installation

1. See if it exists
rpm -qa | grep mariadb

2. uninstall

yum remove mariadb-libs 

3. Unzip the file

tar -xvf mysql-8.0.27-1.el7.x86_64.rpm-bundle.tar

4. install mysql

mysql-community-common
rpm -ivh …… -c --nodeps --force
 rpm -ivh mysql-community-common-8.0.27-1.el7.x86_64.rpm -c --nodeps --force

  

 mysql-community-libs

rpm -ivh mysql-community-libs-8.0.27-1.el7.x86_64.rpm -c --nodeps --force

 mysql-community-client

 rpm -ivh mysql-community-client-8.0.27-1.el7.x86_64.rpm -c --nodeps --force

 mysql-community-server

rpm -ivh mysql-community-server-8.0.27-1.el7.x86_64.rpm -c --nodeps --force

 

Check mysql Installation
rpm -qa|grep mysql

 5. initialization mysql

mysqld --initialize;

  Generate mysql Initialization password

chown mysql:mysql /var/lib/mysql -R;

Turn on mysql service

systemctl start mysqld.service;

start-up mysql

systemctl enable mysqld;

View the database default follow-up password

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

Change Password

ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

  Open the firewall port

firewall-cmd --zone=public --add-port=3306/tcp --permanent

service iptables restart

systemctl restart firewalld

Create user

 create USER [email protected]'%' IDENTIFIED BY 'smy123';

Grant authority

 grant all on *.* to [email protected]'%';

原网站

版权声明
本文为[Gu Bei!]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206222027337243.html