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.36 Database in Linux Environment

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

Share

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

Today, I will talk to you about how to install mysql5.7.36 database in Linux environment, many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

Download address: https://dev.mysql.com/downloads/mysql/5.7.html#downloads

Upload to the server

Rz-be

Extract the file

Tar-xvf mysql-5.7.36-linux-glibc2.12-x86_64.tar.gz

Move and rename again.

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

Create mysql user groups and users and modify permissions

Groupadd mysqluseradd-r-g mysql mysql

If groupadd: group 'mysql' already exists appears, never mind that you have installed mysql before, just skip it

Create a data directory and grant permissions

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

Configure my.cnf

Vim / etc/my.cnf

The contents are as follows

[mysqld] bind-address=0.0.0.0port=3306user=mysqlbasedir=/usr/local/mysqldatadir=/data/mysqlsocket=/tmp/mysql.socklog-error=/data/mysql/mysql.errpid-file=/data/mysql/mysql.pid#character configcharacter_set_server=utf8mb4symbolic-links=0explicit_defaults_for_timestamp=trueinnodb_log_file_size = 512Mmax_allowed_packet = 200m

Finish editing: wq! Save and exit

Initialize the database

Enter 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

First put the mysql.server into / etc/init.d/mysql

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

Start mysql to view the mysql process

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. The previous one is randomly generated.

. / mysql-u root-p # bin directory

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

SET PASSWORD = PASSWORD ('123456'); ALTER USER' root'@'localhost' PASSWORD EXPIRE NEVER;FLUSH PRIVILEGES; update user set host ='% 'where user =' root'; # so that root can access FLUSH PRIVILEGES;# refresh from any host

Connect the mysql visualization tools

After reading the above, do you have any further understanding of how to install mysql5.7.36 database in Linux environment? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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