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

How to install MYSQL8.X in Centos

2025-03-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces Centos how to install MYSQL8.X, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Installation of MySQL (4, 5, 5, 6 may be omitted)

Disclaimer: CentOS version 7.6, installed MySQL version 8.0.17

1. The first step is to uninstall the native mysql dependencies, including MariaDB.

Rpm-pa | grep mysql # delete the found results using `rm-rf file name`, skip rpm-pa if not, delete the found results using `rm-rf filename `, skip find /-name mysql # to find and delete related folders if not, skip (ibid.) find /-name mariadb # to find and delete related folders, and skip if not (ibid.)

two。 Back up the default repo source of centOS, and download Ali Cloud or NetEase's repo source replacement default source.

Mv / etc/yum.repos.d/CentOS-Base.repo / etc/yum.repos.d/CentOS-Base.repo.backupcd / etc/yum.repos.d/wget-O / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3. Clean up the yum and create a yum cache.

Sudo yum clean allsudo yum makecache

4. View mysql-related content in the software source repository

Yum repolist | grep mysql

5. Check whether the corresponding version of mysql is enabled

Cat / etc/yum.repos.d/mysql-community

6. Set the version that needs to be installed to enabled (I am installing mysql Community version 8.0 here)

Yum-config-manager-enable mysql80-comminity

7. Perform installation

Yum install mysql-community-server.x86_64

8. Check the running status of mysql. The installation is not started by default.

# check the running status of MySQL service. Active means started, inactive means not started, failed means start failed systemctl status mysqld.service# starts MySQL service systemctl start mysqld.service# stops MySQL service systemctl stop mysqld.service# restarts MySQL service systemctl restart mysqld.service

9. View initial password

The new version of mysql just installed will automatically generate a temporary password and save it in `/ etc/log/ mysqld.log`.

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

10. Log in with the initial password

Copy the password from the previous step, enter the `password-uroot-p password `, or press enter without entering the password and paste the password at the prompt (if the password is not displayed, just paste it once).

11. Change the initial password

If show databases;use mysql;# changes the password to NewPassword!, try to include uppercase and lowercase alphanumeric plus symbol alter 'user'@'localhost' identified by' NewPasswordwords' for security reasons.

twelve。 Modify access permissions so that they can connect remotely

Update user set Host='%' where User='root' and Host='localhost'

13. Refresh permissions

Flush privileges

14. New user

Create user user name identified by 'password'; # for example, create a user to specify the host that can be accessed at the same time, and specify the database table that the user can access and the corresponding permission create user user name @ 'host name' identified by 'password'; grant select, update, create, delete on database name. Table name to user name

15. Give permission. Remember to refresh permission before it takes effect.

Grant select on database name. Table name to user; # all permissions can use all

Flush privileges

MySQL backup

Backup: data table structure + data

Mysqdump-u root db1 > db1.sql-p

Backups: data table structure

Mysqdump-u root-d db1 > db1.sql-p

Import existing data into a database

Create a new database first

Create database db10

Import the existing database file into the db10 database

Mysqdump-u root-d db10 < db1.sql-p

= = attention = =

= if the database reports an error: =

= "Job for mysqld.service failed because the control process exited with error code. See" systemctl status mysqld.service "and" journalctl-xe "for details." =

Solution:

Database initialization:

Rm-rf / var/log/mysql.logrm-rf / var/ib/mysql

Thank you for reading this article carefully. I hope the article "how to install Centos MYSQL8.X" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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