Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux install MySQL8.0

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Download the software package (download it locally, upload it to the linux directory, and generally upload it to the / usr/local/src/ directory):

According to the number of bits of Linux, please download the appropriate software installation package: 32-bit download 32-bit installation package, 64-bit download 64-bit installation package

1.1 download manually on the official website:

Official website: https://dev.mysql.com/downloads/mysql/

1.2 download Linux image (download to directory / usr/local/src/):

Cd / usr/local/src/

Wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz

2. Installation

2.1 extract the installation package

# enter the download directory

/ usr/local/src/

# decompression

Tar-zxvf mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz

# View

Ls

# display content:

# mysql-8.0.11-linux-glibc2.12-x86_64.

# move the extracted folder to / usr/local

Mv / usr/local/src/mysql-8.0.11-linux-glibc2.12-x86_64 / usr/local/

Cd / usr/local/

# rename

Mv. / mysql-8.0.11-linux-glibc2.12-x86_64 mysql-8.0

# create a folder data to store files

Cd / usr/local/mysql-8.0/

Mkdir. / data

2.2 create users and user groups

# user groups

Groupadd mysql

# user (username / password)

Useradd-g mysql mysql

2.3 authorization

Chown-R mysql.mysql / usr/local/mysql-8.0/ # parent test

Or

Chown-R mysql.

Chgrp-R mysql.

2.4 initialize the database:

# View the current directory

Pwd # if / usr/local/mysql-8.0 is displayed, please continue, otherwise please enter this directory / usr/local/mysql-8.0 first

# initialize to check whether the relevant directory exists. If it does not exist, please create a new one.

. / bin/mysqld-- user=mysql-- basedir=/usr/local/mysql-8.0/-- datadir=/usr/local/mysql-8.0/data/-- initialize; # testing

Or

. / bin/mysql-user=mysql-basedir=/usr/local/mysql-8.0/-datadir=/usr/local/mysql-8.0/data/-initialize

Note: screenshot of "temporary password" generated from lines 12-13 from top to bottom

2.5 Mysql configuration

Vi / etc/my.cnf

2.6 Establishment of MySQL services

# add Mysql to the system service

Cp-a. / support-files/mysql.server / etc/init.d/mysql # if mysqld, modify the mysqld accordingly in the following mysql, as shown in the following figure

Chmod + x / etc/init.d/mysql

Chkconfig-add mysql

# check whether the service is effective

Chkconfig-list mysql

3. Start the Mysql service

# start

Service mysql start

# check startup status

Service mysql status

Log in to Mysql:

# Log in

Mysql-uroot-p

# enter the "temporary password" during the "initialize Database" operation

Change the password:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY' New password

4. Remote connection

1. Add under the mysqld of my.cnf

Default_authentication_plugin=mysql_native_password

two。 Enter the mysql command line

Use mysql

Update user set host ='% 'where user='root'

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY' root'

FLUSH PRIVILEGES

Use client tools to connect.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report