Installation tutorial of mysql8.0rpm on centos7

Installation tutorial of mysql8.0rpm on centos7

First, download the diagram

1. First uninstall the mariadb that comes with centos7

rpm -qa|grep mariadb //Query the installed mariadb
rpm -e --nodeps file name //Uninstall mariadb, the file name is the file queried by the above command

2. Check whether mysql has been installed

rpm -qa | grep -i mysql

Find the mysql file and delete it using rm -rf mysql file path

find / -name mysql

Delete scattered mysql files

find / -name mysql / # whereis mysql

Deleting a Configuration Document

rm -rf /etc/my.cnf

Check again whether mysql is installed on the machine

rpm -qa|grep -i mysql

3. Install MySQL dependency package (optional)

yum -y install libaio.so.1 libgcc_s.so.1 libstdc++.so.6
yum update libstdc++-4.4.7-4.el6.x86_64
yum search libaio # Retrieve relevant information yum install libaio # Install dependent packages yum install net-tools

4. Unzip MySQL-5.6.40-1.el7.x86_64.rpm-bundle.tar to the mysql directory under /usr/local/ (create the mysql directory manually, mkdir mysql)

tar -xvf MySQL-5.6.40-1.el7.x86_64.rpm-bundle.tar -C /usr/local/mysql

5. Install mysql in /usr/local/mysql. Note that the installation has a sequence and dependencies.

rpm -ivh …common.rpm
rpm -ivh …libs.rpm
rpm -ivh …client.rpm
rpm -ivh …server.rpm

After the installation is complete, the following directory will be generated to store MySQL related files

clip_image002

6. Initialize mysql

mysqld --initialize --user=mysql

After initialization is complete, there will be a random password at the end of the file below. You will use it when you log in later.

cat /var/log/mysqld.log
clip_image004
Cg!hLde4oLG+

6. Start, stop, and restart MySQL

start up:

systemctl start mysqld.service

Start using service: service mysqld start

Start using the mysqld script: /etc/inint.d/mysqld start

Start using safe_mysqld: safe_mysqld&

stop:

Start using service: service mysqld stop

Start using the mysqld script: /etc/inint.d/mysqld stop

mysqladmin shutdown

Restart:

Start using service: service mysqld restart

Start using the mysqld script: /etc/inint.d/mysqld restart

8. Log in to MySQL

mysql -u root -p
clip_image006 

9. Change password (log in to mysql)

alter user 'root'@'localhost' identified by '123456';
clip_image007

In mysql8.0, the alert command must be used to modify it, otherwise the following error will occur:

clip_image008

10. Enable remote login to mysql

After login

show databases;
use mysql;
updata user set host='%' where user = 'root';
select user,host from user;
clip_image009
clip_image010 

11. Firewall Operation

Start a service: systemctl start firewalld.service

Shut down a service: systemctl stop firewalld.service

Restart a service: systemctl restart firewalld.service

Display the status of a service: systemctl status firewalld.service

Enable a service at boot: systemctl enable firewalld.service

Disable a service at boot: systemctl disable firewalld.service

Check whether the service is started: systemctl is-enabled firewalld.service

View the list of started services: systemctl list-unit-files | grep enabled

View the list of services that failed to start: systemctl --failed

12. Port Operation

Add to

firewall-cmd --zone=public --add-port=80/tcp --permanent (--permanent takes effect permanently, and will become invalid after restart without this parameter)

Reload

firewall-cmd –reload

Summarize

The above is the installation tutorial of mysql8.0rpm on centos7 introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • How to install MySQL 8.0.13 in Alibaba Cloud CentOS 7
  • Detailed tutorial on installing MySQL 8.0.20 database on CentOS 7
  • Tutorial on installing mysql8 on linux centos7
  • CentOS7.5 installation of MySQL8.0.19 tutorial detailed instructions
  • Tutorial diagram of installing mysql8.0.18 under linux (Centos7)
  • Detailed steps to install MYSQL8.0 on CentOS7.6
  • CentOS7 enables MySQL8 master-slave backup and daily scheduled full backup (recommended)
  • Detailed tutorial on installing MySQL 8.0 from source code on CentOS 7.4
  • Centos7 installation of MySQL8 tutorial

<<:  Detailed explanation of Tomcat configuration and optimization solutions

>>:  Detailed explanation of asynchronous iterators in nodejs

Recommend

Linux kernel device driver advanced character device driver notes

/****************** * Advanced character device d...

Tutorial on using hyperlink tags in XHTML

Hyperlink, also called "link". Hyperlin...

Cross-origin image resource permissions (CORS enabled image)

The HTML specification document introduces the cr...

Class in front-end JavaScript

Table of contents 1. Class 1.1 constructor() 1.2 ...

Server concurrency estimation formula and calculation method

Recently, I need to stress test the server again....

Problems installing TensorRT in docker container

Uninstall the installed version on Ubuntu: sudo a...

How to automatically start RabbitMq software when centos starts

1. Create a new rabbitmq in the /etc/init.d direc...

Let's deeply understand the event object in js

We know that the commonly used events in JS are: ...

Using jQuery to implement the carousel effect

What I bring to you today is to use jQuery to imp...

In-depth analysis of MySQL query interception

Table of contents 1. Query Optimization 1. MySQL ...

How to get datetime data in mysql, followed by .0

The data type of MySQL is datetime. The data stor...