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

What are the specific steps for installing MySQL under Linux

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

Share

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

This article introduces you what are the specific steps of installing MySQL under Linux, the content is very detailed, interested friends can refer to, hope to be helpful to you.

How to install MySQL under Linux? MySQL is a relational database management system. MySQL is one of the most popular relational database management systems. In the aspect of WEB application, MySQL is one of the best RDBMS (Relational Database Management System) application software.

Linux install MySQL 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

Ok!!!! MySQL5.7 is ready to install. There are really many holes. But if we follow this process, we should be able to install it smoothly. Because I pretended it twice. )

If you do not want to use the mysql command in the bin directory every time, execute the following command

Ln-s / usr/local/mysql/bin/mysql / usr/bin on the specific steps of installing MySQL under Linux is shared here, I hope the above content can be of some help to you, you can learn more knowledge. If you think the article is good, you can share it for more people to see.

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