MySQL (Linux) installation

Table of contents

1 Uninstall the original mysql (mariadb)

2 download yum

3 to see if it works

4 Install mysql service

5 Start the service

6 Login method

7 Final configuration

8 PS


1 Uninstall the original mysql (mariadb)

rpm -qa | grep mysql(mariadb) | xargs yum -y remove

(The role of xargs is to feed the results displayed earlier to the following commands one by one)

2 download yum

Index of /232905 (mysql.com)

Download to desktop and then rz

One-click installation of yum source for yum (el -- means centos)

3 to see if it works

yum list |grep mysql

4 Install mysql service

yum install -y mysql-community-server

(If you report an error at this time: Failing package is: mysql-community-client-5.7.39-1.el7.x86_64GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY -mysql solution: rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

With these three, it means that the installation is complete.

5 Start the service

systemctl start mysqld.service

Netstat -nltp can show mysql

(If it fails to start, follow the prompts to check online)

6 Login method

vim /etc/my.cnf # Open the mysql configuration file

Configure in the last column of [mysqld] (I don’t know what it is, just put it at the end of the configuration file) Add: skip-grant-tables option, save and exit (set password-free login)

Then systemctl restart mysqld.service

Then

That's it! (quit exit)

7 Final configuration

character-set-server=utf8
default-storage-engine=innodb

8 PS

port=3306 -- port
datadir=/var/lib/mysql -- where the data exists (the most important)
socket=/var/lib/mysql/mysql.sock -- In order to support local communication information, it will write its own process pid into it when starting, mainly for pipeline communication

Guess you like

Origin blog.csdn.net/weixin_62700590/article/details/130001855