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 MySQL on Linux system

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

Share

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

This article mainly introduces the relevant knowledge of "how to install MySQL in Linux system". The editor shows you the operation process through an actual case. The method of operation is simple, fast and practical. I hope this article "how to install MySQL in Linux system" can help you solve the problem.

First enter the Linux command line interface remotely through xshell or putty.

[1] check to see if Mysql is installed

Rpm-qa | my operation is below grep mysql. It can be seen that Mysql is not installed, so go directly to [2].

If you see something, you can delete it using the following command (xxx is the full name of the file)

Rpm-e xxx [2] download the official Mysql package

Wget-I-c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

[3] install Mysql package

Yum-y install mysql57-community-release-el7-10.noarch.rpm

[4] install Mysql (this step will take a few minutes, wait for installation)

Yum-y install mysql-community-server

[5] start the Mysql service

Systemctl start mysqld.service

If there is no error, enter [6]

If you execute an error, you probably don't have permission, execute the following statement to grant permission, and then try again.

Chown mysql:mysql-R / var/lib/mysql [6] View Mysql running status

When service mysqld status sees this green, it indicates that the startup is successful.

[7] View the initial password (the yellow box is the initial password)

Grep 'password' / var/log/mysqld.log if it can be seen normally, then OK; does not have a password if it cannot be seen.

[8] access to the database

Mysql-u root-p enter the command, click enter, you will be asked to enter the password, and then enter the initial password (password is not visible when typing), of course, you can paste, you can copy the initial password, and then paste. If you don't have a password, you can enter directly.

[9] modify root password (xxxx is password)

Try to make the password as complex as possible (uppercase and lowercase plus symbols).

ALTER USER USER () IDENTIFIED BY 'XXXX'

If the password is too simple, the following information is prompted:

[10] log out and log in again

After changing the password, you need to exit out first, and then log in again according to [8]. This time the password entered is your new password.

[11] use SQL statement

After entering again, you can use the SQL statement to do database-related operations, for example, we can check which databases are currently connected.

One last note: add a semicolon after each SQL!

This is the end of the introduction on "how to install MySQL in Linux system". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

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

Development

Wechat

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

12
Report