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 (CentOS7) tutorial for installing mysql 8.0.11 using RPM

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

1. Installation preparation 1. View Linux related information (Linux command line operation)

(1) View Linux version, which is used to download the corresponding mysql.

[view Linux information:] uname-a

(2) check whether mysql has been installed.

[check if mysql is installed]

Rpm-qa | if grep-I mysql has been installed, the relevant package name will be output

[delete related files if mysql is installed]

Rpm-e [--nodeps] package name (here the package name is the name found by the above command)

2. Download mysql

(1) official website address

[official website address:]

Https://downloads.mysql.com/archives/community/

Https://downloads.mysql.com/archives/get/p/23/file/mysql-community-libs-8.0.11-1.el7.x86_64.rpm

Https://downloads.mysql.com/archives/get/p/23/file/mysql-community-common-8.0.11-1.el7.x86_64.rpm

Https://downloads.mysql.com/archives/get/p/23/file/mysql-community-server-8.0.11-1.el7.x86_64.rpm

Https://downloads.mysql.com/archives/get/p/23/file/mysql-community-client-8.0.11-1.el7.x86_64.rpm

(2) choose the appropriate version

[select the appropriate rpm package]

Mysql-community-common-8.0.11-1.el7.x86_64.rpm

Mysql-community-libs-8.0.11-1.el7.x86_64.rpm

Mysql-community-server-8.0.11-1.el7.x86_64.rpm

Mysql-community-client-8.0.11-1.el7.x86_64.rpm

2. Start installation 1. Transfer files to / opt directory

Use xFtp6 to transfer the downloaded files from windows to Linux (optional, you can download them directly on Linux).

2. RPM install mysql

(1) Step1: execute the installation command

Rpm-ivh package name [installation order: (packages depend on each other, so you must pay attention to the installation order)] install common before installing libs (make sure that mariadb has been uninstalled. Centos7 supports mariadb by default, not mysql. If you do not uninstall, there will be conflicts) reinstall client and finally install server [root@localhost opt] # rpm-ivh mysql-community-common-8.0.11-1.el7.x86_64.rpm [root@localhost opt] # rpm-e-nodeps mariadb-libs-5.5.64-1.el7.x86_64 [root@localhost opt] # rpm-ivh mysql-community-libs-8.0.11-1.el7.x86_64.rpm [root@localhost opt] # rpm-ivh mysql -community-client-8.0.11-1.el7.x86_64.rpm [root@localhost opt] # rpm-ivh mysql-community-server-8.0.11-1.el7.x86_64.rpm

(2) Step2: check whether the installation is successful

[method 1:]

After mysql is installed successfully, mysql users and user groups will be established automatically.

Cat / etc/passwd | grep mysql

Cat / etc/group | grep mysql

[method 2:]

Mysqladmin-version

3. Start the mysql service

(1) Step1: check whether the current service is started

[method 1:]

Ps-ef | grep mysql

[method 2:]

Service mysqld stauts

(2) Step2: start and stop mysql service

[start mysql service:]

Service mysql start

[shut down the mysql service: (optional)]

Service mysql stop

4. Connect mysql

An error was reported when connecting to the database for the first time.

[login for the first time:]

Mysql

[if an error message is prompted: (password is required)]

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

(1) solution 1: check the initial password and login with it.

[solution 1: (check the initial password for login)]

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

(2) solution 2:

[solution 2: (edit the my.cnf file to skip the password)]

Locate the configuration file for mysql (ending with .cnf).

Find /-name "* / .cnf"

Or:

Mysql-- help | grep-A 1 'Default options'

Edit the configuration file (my.cnf), locate [mysqld], and add

Skip-grant-tables # is used to skip password login

Restart the service:

Service mysqld restart

No password is required for login:

Mysql

5. Change the initial password

Through the above two methods, you can enter the mysql, but the password is the initial password, or there is no password, which must be difficult to operate. A custom password is required.

(1) set the login password and connect to the database again.

[set password:]

Mysql > ALTER USER root@localhost IDENTIFIED BY '123456'

[if an error occurs:]

ERROR 1290 (HY000): The MySQL server is running with the-- skip-grant-tables option so it cannot execute this statement

[resolve: (execute the following statement)]

Mysql > flush privileges

Mysql > ALTER USER root@localhost IDENTIFIED BY '123456'

[log in again]

Mysql-uroot-p

(2) after setting the initial password, you need to edit / etc/my.cnf to remove the previously added skip-grant-tables.

Restart the service.

[root@localhost /] # vim / etc/my.cnf [root@localhost /] # service mysqld restart

Summary

This is the end of this article on Linux (CentOS7) using RPM to install mysql 8.0.11. For more information about linux rpm installation of mysql 8.0.11, please search for previous articles or continue to browse the relevant articles below. I hope you will support it in the future!

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

Servers

Wechat

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

12
Report