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

Comprehensive review of the concise installation guide mysql 8 installation, upgrade and configuration

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

Share

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

1. Installation

Official document: https://dev.mysql.com/doc/refman/8.0/en/installing.html

1.1 MySQL installation in Windows environment

MySQL noinstall ZIP Archives

MySQL Installer

1.1.1 installation of MySQL compressed version in Windows environment (software-free installation)

After downloading the software package in this version, there is no need to install the software, initialize the database directly, and generate database files and database services.

(1) download and decompress

Download path: https://dev.mysql.com/downloads/mysql/

The directory structure after decompression is shown in the figure:

(2) add configuration file

Under the unzipped root directory, you need to add the configuration file my.ini.

The simplest part of the configuration file is to set two parameter values, basedir and datadir. That is, the software installation directory and database file directory.

Use double "\" to split the directory in the path, or a single "/" if you don't use this.

(3) initialize the database

Change to the bin directory, or configure the bin directory to the environment variable.

Execute the initialization command:

Cmd > mysqld-- initialize

After completion, a bunch of database-related files are generated in the data directory

Go to the data directory and find the file at the end of .err with the initial password of the database.

(3) install MySQL service cmd > mysqld-install mysql8

(4) start the service cmd > net start mysql8

The name of the service you just created appears in the list of services.

(5) Log in and change the initial password cmd > mysql-uroot-pairtRNwLhroomwo9qA'

The password here is the random password in the .err file in step (2) data.

Change the password:

ALTER USER 'root'@'localhost' IDENTIFIED BY' Yxc_123456'

Then log out and log back in with the new password. At this point, the installation of the compressed version under the Windows environment has been completed successfully.

(6) Uninstall and stop the service

Query service status

Cmd > sc query mysql8

Cmd > net stop mysql8

Delete service cmd > sc delete mysql8

Delete database files

Delete the data directory, or delete the database software directory completely.

1.1.2 graphical installation of MySQL in Windows environment (1) download

Download path: https://dev.mysql.com/downloads/windows/installer/8.0.html

(2) installation

Choose Server Only here.

(3) Login verification

Enter the installation directory in cmd, C:\ Program Files\ MySQL\ MySQL Server 8.0\ bin, or configure the directory to the environment variable.

Query the database file path:

(4) Uninstall

Enter the Installer interface:

Execute until the end.

1.2 MySQL installation in CentOS 7 1.2.1 install Mysql using YUM (1) query operating system version cat / etc/redhat-release

CentOS Linux release 7.4.1708 (Core)

(2) add MySQL YUM warehouse

Add the MySQL YUM repository to the list of operating system repositories.

a. Download MySQL YUM Warehouse https://dev.mysql.com/downloads/repo/yum/

b. Select the relevant packages for the corresponding platform. Select RedHat 7 here.

-rw-r-r-. 1 mysql mysql 26024 Apr 9 14:31 mysql80-community-release-el7-3.noarch.rpm

c. Install the YUM warehouse package

Sudo yum localinstall mysql80-community-release-el7-3.noarch.rpm (4) Select Discovery Series

When using the MySQL Yum repository, the latest GA series (currently MySQL 8.0) is selected by default for installation. So here, actually, we can skip to the next step.

See which child repositories are enabled or disabled:

Yum repolist all | grep mysql

The following commands disable the child repositories of 5.7 series and enable the subrepositories of 8.0 series:

Shell > sudo yum-config-manager-- disable mysql57-communityshell > sudo yum-config-manager-- enable mysql80-community

You can also select a release series by manually editing the / etc/yum.repos.d/mysql-community.repo file. This is a typical entry for a release series child repository in a file:

[mysql57-community] name=MySQL 5.7 Community Serverbaseurl= http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/enabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

Find the entry for the child repository you want to configure, and then edit the enabled option. Specifies that enabled=0 disables subrepositories or enabled=1 enables subrepositories. For example, to install MySQL 8.0, make sure that you have the above sub-repository entry for enabled=0 for MySQL 5.7 and the entry for enabled=1 for 8.0 series:

# Enable to use MySQL 8.0 [mysql80-community] name=MySQL 8.0 Community Serverbaseurl= http://repo.mysql.com/yum/mysql-8.0-community/el/6/$basearch/enabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

You can only enable subrepositories for a distribution series at any time. If you enable sub-repositories of multiple release series, Yum will use the latest series.

Shell > yum repolist enabled | grep mysql

(4) install MySQLshell > sudo yum install mysql-community-server (5) start the MySQL service

Start the MySQL server using the following command:

Shell > sudo service mysqld startStarting mysqld: [OK]

You can check the status of the MySQL server using the following command:

Shell > sudo service mysqld statusmysqld (pid 3066) is running.

Assuming that the server's data directory is empty, the following occurs when the server starts for the first time:

The server has been initialized.

SSL certificate and key files are generated in the data directory.

Validate_password is installed and enabled.

'root'@'localhost creates a superuser account. Set the superuser's password and store it in the error log file. To display it, use the following command:

Shell > sudo grep 'temporary password' / var/log/mysqld.log

Change the root password by logging in with the generated temporary password and setting a custom password for the superuser account as soon as possible:

Shell > mysql-uroot-pmysql > ALTER USER 'root'@'localhost' IDENTIFIED BY' MyNewPass4passport'

To be continued... ..

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

Wechat

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

12
Report