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 mysql5.7 for Linux

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

Share

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

This article mainly explains "how to install mysql5.7 in Linux". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to install mysql5.7 in Linux.

MySQL is the most popular relational database management system, and MySQL is one of the best RDBMS (Relational Database Management System: relational database management system) applications in WEB applications.

Linux install mysql5.7 step by step download address: https://dev.mysql.com/downloads/mysql/5.7.html#downloads

Decompress tar-xvf mysql-5.7.26-linux-glibc2.12-x86_64.tar

Move and rename again.

Mv mysql-5.7.26-linux-glibc2.12-x86_64 / usr/local/mysql

Create mysql user groups and users and modify permissions groupadd mysql useradd-r-g mysql mysql create data directories and grant permissions

Mkdir-p / data/mysql # create directory chown mysql:mysql-R / data/mysql # Grant permissions

Configure my.cnf

The vim / etc/my.cnf content is as follows

[mysqld] bind-address=0.0.0.0 port=3306 user=mysql basedir=/usr/local/mysql datadir=/data/mysql socket=/tmp/mysql.sock log-error=/data/mysql/mysql.err pid-file=/data/mysql/mysql.pid # character config character_set_server=utf8mb4 symbolic-links=0 explicit_defaults_for_timestamp=true

Initialize the database into the bin directory of mysql

Cd / usr/local/mysql/bin/ initialization

. / mysqld-- defaults-file=/etc/my.cnf-- basedir=/usr/local/mysql/-- datadir=/data/mysql/-- user=mysql-- initialize view password

Cat / data/mysql/mysql.err

Start mysql and change the root password to put mysql.server in / etc/init.d/mysql first

Cp / usr/local/mysql/support-files/mysql.server / etc/init.d/mysql start!

Service mysql start ps-ef | grep mysql

It means that mysql has been installed successfully!

Let's change the password

First log in to mysql, and the previous one is randomly generated.

. / mysql-u root-p # bin directory

Perform the following three steps, and then log in again.

SET PASSWORD = PASSWORD ('123456'); ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER; FLUSH PRIVILEGES

If you use a remote connection at this time... You will find that you cannot connect.

The following three commands are mainly executed here (log in to the database first)

Use mysql # accesses the mysql library update user set host ='% 'where user =' root'; # so that root can access FLUSH PRIVILEGES; # refresh from any host

At this point, I believe you have a deeper understanding of "Linux how to install mysql5.7". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue 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

Development

Wechat

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

12
Report